Skip to content

Commit

Permalink
revert rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
microstudi committed Feb 5, 2024
1 parent e50f58c commit d385786
Show file tree
Hide file tree
Showing 31 changed files with 94 additions and 92 deletions.
1 change: 0 additions & 1 deletion db/migrate/00000000000001_setup_hstore.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class SetupHstore < ActiveRecord::Migration
def self.up
enable_extension "hstore"
end

def self.down
disable_extension "hstore"
end
Expand Down
1 change: 0 additions & 1 deletion db/migrate/00000000000002_setup_pg_trgm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ class SetupPgTrgm < ActiveRecord::Migration
def self.up
enable_extension "pg_trgm"
end

def self.down
disable_extension "pg_trgm"
end
Expand Down
9 changes: 6 additions & 3 deletions db/migrate/20121019101022_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :username, null: false # if you use another field as a username, for example email, you can safely remove this field.
t.string :email, null: false # if you use this field as a username, you might want to make it :null => false.
t.string :password_digest, default: nil
t.string :username, :null => false # if you use another field as a username, for example email, you can safely remove this field.
t.string :email, :null => false # if you use this field as a username, you might want to make it :null => false.
t.string :password_digest, :default => nil
t.date :date_of_birth
t.string :identity_document
t.string :member_code
Expand All @@ -22,4 +22,7 @@ def change
add_index :users, :email
add_index :users, :organization_id
end

end


10 changes: 5 additions & 5 deletions db/migrate/20121104085711_create_categories.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ def change
end
add_index :categories, :parent_id

create_table :category_hierarchies, id: false do |t|
t.integer :ancestor_id, null: false # ID of the parent/grandparent/great-grandparent/... tag
t.integer :descendant_id, null: false # ID of the target tag
t.integer :generations, null: false # Number of generations between the ancestor and the descendant. Parent/child = 1, for example.
create_table :category_hierarchies, :id => false do |t|
t.integer :ancestor_id, :null => false # ID of the parent/grandparent/great-grandparent/... tag
t.integer :descendant_id, :null => false # ID of the target tag
t.integer :generations, :null => false # Number of generations between the ancestor and the descendant. Parent/child = 1, for example.
end

# For "all progeny of…" selects:
add_index :category_hierarchies, %i[ancestor_id descendant_id], unique: true
add_index :category_hierarchies, [:ancestor_id, :descendant_id], :unique => true

# For "all ancestors of…" selects
add_index :category_hierarchies, [:descendant_id]
Expand Down
6 changes: 4 additions & 2 deletions db/migrate/20130222185624_create_transfer.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
class CreateTransfer < ActiveRecord::Migration
def up; end
def up
end

def down; end
def down
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ def change
drop_table :category_hierarchies
end
end

8 changes: 4 additions & 4 deletions db/migrate/20130621105452_acts_as_taggable_on_migration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,18 @@ def self.up

# You should make sure that the column created is
# long enough to store the required class names.
t.references :taggable, polymorphic: true
t.references :tagger, polymorphic: true
t.references :taggable, :polymorphic => true
t.references :tagger, :polymorphic => true

# Limit is created to prevent MySQL error on index
# length for MyISAM table type: http://bit.ly/vgW2Ql
t.string :context, limit: 128
t.string :context, :limit => 128

t.datetime :created_at
end

add_index :taggings, :tag_id
add_index :taggings, %i[taggable_id taggable_type context]
add_index :taggings, [:taggable_id, :taggable_type, :context]
end

def self.down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ def up
add_column :categories, :name_translations, :hstore
remove_column :categories, :name
end

def down
remove_column :categories, :name_translations, :hstore
add_column :categories, :name
Expand Down
14 changes: 9 additions & 5 deletions db/migrate/20131027215517_add_tags_to_posts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def up
say "Tag column added"

ActiveRecord::Base.connection.execute(
<<-SQL
<<-SQL
WITH prepared_tags AS (
SELECT "posts"."id" AS "id", array_agg("tags"."name") AS "tags"
FROM "posts"
Expand All @@ -28,6 +28,7 @@ def up
drop_table :tags

say "acts_as_taggable_on tables removed"

end

def down
Expand All @@ -42,20 +43,23 @@ def down

# You should make sure that the column created is
# long enough to store the required class names.
t.references :taggable, polymorphic: true
t.references :tagger, polymorphic: true
t.references :taggable, :polymorphic => true
t.references :tagger, :polymorphic => true

# Limit is created to prevent MySQL error on index
# length for MyISAM table type: http://bit.ly/vgW2Ql
t.string :context, limit: 128
t.string :context, :limit => 128

t.datetime :created_at
end

add_index :taggings, :tag_id
add_index :taggings, %i[taggable_id taggable_type context]
add_index :taggings, [:taggable_id, :taggable_type, :context]


remove_column :posts, :tags
remove_index :posts, :tags
end
end


10 changes: 5 additions & 5 deletions db/migrate/20131029202724_create_active_admin_comments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ def self.up
create_table :active_admin_comments do |t|
t.string :namespace
t.text :body
t.string :resource_id, null: false
t.string :resource_type, null: false
t.references :author, polymorphic: true
t.string :resource_id, :null => false
t.string :resource_type, :null => false
t.references :author, :polymorphic => true
t.timestamps
end
add_index :active_admin_comments, [:namespace]
add_index :active_admin_comments, %i[author_type author_id]
add_index :active_admin_comments, %i[resource_type resource_id]
add_index :active_admin_comments, [:author_type, :author_id]
add_index :active_admin_comments, [:resource_type, :resource_id]
end

def self.down
Expand Down
1 change: 1 addition & 0 deletions db/migrate/20131104013829_migrate_membership_data.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
class MigrateMembershipData < ActiveRecord::Migration

class User < ActiveRecord::Base
has_one :account, as: :accountable
has_many :members
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20131220160257_add_active_to_user.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddActiveToUser < ActiveRecord::Migration
def change
add_column :users, :active, :boolean, default: true
add_column :users, :active, :boolean, :default => true
end
end
2 changes: 1 addition & 1 deletion db/migrate/20131227110122_create_documents.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def change

t.timestamps
end
add_index :documents, %i[documentable_id documentable_type]
add_index :documents, [:documentable_id, :documentable_type]
add_index :documents, :label
end
end
6 changes: 3 additions & 3 deletions db/migrate/20131227155440_add_devise_things_to_users.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ def change
change_table :users do |t|
## Database authenticatable
# t.string :email, :null => false, :default => ''
t.string :encrypted_password, null: false, default: ""
t.string :encrypted_password, :null => false, :default => ''

## Recoverable
t.string :reset_password_token
Expand All @@ -13,7 +13,7 @@ def change
t.datetime :remember_created_at

## Trackable
t.integer :sign_in_count, default: 0
t.integer :sign_in_count, :default => 0
t.datetime :current_sign_in_at
t.datetime :last_sign_in_at
t.string :current_sign_in_ip
Expand All @@ -26,7 +26,7 @@ def change
t.string :unconfirmed_email

## Lockable
t.integer :failed_attempts, default: 0
t.integer :failed_attempts, :default => 0
t.string :unlock_token
t.datetime :locked_at

Expand Down
1 change: 0 additions & 1 deletion db/migrate/20140119161433_add_organization_to_post.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ def up
end
end
end

def down
remove_reference :posts, :organization, index: true
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddNewFieldsToOrganization < ActiveRecord::Migration
def change
change_table :organizations do |t|
change_table :organizations do |t|
t.string :email
t.string :phone
t.string :web
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140514225527_add_active_fields_to_member.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class AddActiveFieldsToMember < ActiveRecord::Migration
def change
add_column :members, :active, :boolean, default: true
add_column :members, :active, :boolean, :default => true
end
end
6 changes: 3 additions & 3 deletions db/migrate/20180221161343_create_device_tokens.rb
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
class CreateDeviceTokens < ActiveRecord::Migration
def change
create_table :device_tokens do |t|
t.integer :user_id, null: false
t.string :token, null: false
t.integer :user_id, :null => false
t.string :token, :null => false

t.timestamps
end
add_index :device_tokens, %i[user_id token], unique: true
add_index :device_tokens, [:user_id, :token], unique: true
end
end
14 changes: 7 additions & 7 deletions db/migrate/20180501093846_create_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
class CreateEvents < ActiveRecord::Migration
def up
create_table :events do |t|
t.integer :action, null: false
t.integer :action, null:false
t.integer :post_id
t.integer :member_id
t.integer :transfer_id
t.timestamps
end

add_foreign_key :events, :posts, name: "events_post_id_fkey"
add_foreign_key :events, :members, name: "events_member_id_fkey"
add_foreign_key :events, :transfers, name: "events_transfer_id_fkey"
add_foreign_key :events, :posts, name: 'events_post_id_fkey'
add_foreign_key :events, :members, name: 'events_member_id_fkey'
add_foreign_key :events, :transfers, name: 'events_transfer_id_fkey'

add_index :events, :post_id, unique: true, where: "post_id IS NOT NULL"
add_index :events, :member_id, unique: true, where: "member_id IS NOT NULL"
add_index :events, :transfer_id, unique: true, where: "transfer_id IS NOT NULL"
add_index :events, :post_id, unique: true, where: 'post_id IS NOT NULL'
add_index :events, :member_id, unique: true, where: 'member_id IS NOT NULL'
add_index :events, :transfer_id, unique: true, where: 'transfer_id IS NOT NULL'

execute <<-SQL
ALTER TABLE events
Expand Down
6 changes: 3 additions & 3 deletions db/migrate/20180529144243_change_index_on_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ def change
remove_index :events, :member_id
remove_index :events, :transfer_id

add_index :events, :post_id, where: "post_id IS NOT NULL"
add_index :events, :member_id, where: "member_id IS NOT NULL"
add_index :events, :transfer_id, where: "transfer_id IS NOT NULL"
add_index :events, :post_id, where: 'post_id IS NOT NULL'
add_index :events, :member_id, where: 'member_id IS NOT NULL'
add_index :events, :transfer_id, where: 'transfer_id IS NOT NULL'
end
end
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddTitleToPushNotification < ActiveRecord::Migration
def up
add_column :push_notifications, :title, :string, null: false, default: ""
add_column :push_notifications, :title, :string, null: false, default: ''
end

def down
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20180828160700_add_body_to_push_notification.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddBodyToPushNotification < ActiveRecord::Migration
def up
add_column :push_notifications, :body, :string, null: false, default: ""
add_column :push_notifications, :body, :string, null: false, default: ''
end

def down
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20180831161349_add_data_to_push_notification.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class AddDataToPushNotification < ActiveRecord::Migration
def up
add_column :push_notifications, :data, :json, null: false, default: "{}"
add_column :push_notifications, :data, :json, null: false, default: '{}'
end

def down
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ def up
end

def down
puts "no."
puts 'no.'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ def change
movement.transfer&.destroy
end

execute "ALTER TABLE movements ADD CONSTRAINT non_zero_amount CHECK(amount != 0)"
execute 'ALTER TABLE movements ADD CONSTRAINT non_zero_amount CHECK(amount != 0)'
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def change
t.string :checksum, null: false
t.datetime :created_at, null: false

t.index [:key], unique: true
t.index [ :key ], unique: true
end

create_table :active_storage_attachments do |t|
Expand All @@ -21,17 +21,15 @@ def change

t.datetime :created_at, null: false

t.index %i[record_type record_id name blob_id],
name: "index_active_storage_attachments_uniqueness", unique: true
t.index [ :record_type, :record_id, :name, :blob_id ], name: "index_active_storage_attachments_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end

create_table :active_storage_variant_records do |t|
t.belongs_to :blob, null: false, index: false
t.string :variation_digest, null: false

t.index %i[blob_id variation_digest],
name: "index_active_storage_variant_records_uniqueness", unique: true
t.index %i[ blob_id variation_digest ], name: "index_active_storage_variant_records_uniqueness", unique: true
t.foreign_key :active_storage_blobs, column: :blob_id
end
end
Expand Down
3 changes: 1 addition & 2 deletions db/migrate/20230312231058_migrate_hstore_to_json.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
class MigrateHstoreToJson < ActiveRecord::Migration[6.1]
def up
rename_column :categories, :name_translations, :name_translations_hstore
add_column :categories, :name_translations, :jsonb, default: {}, null: false,
index: { using: "gin" }
add_column :categories, :name_translations, :jsonb, default: {}, null: false, index: { using: 'gin' }
execute 'UPDATE "categories" SET "name_translations" = json_object(hstore_to_matrix("name_translations_hstore"))::jsonb'
remove_column :categories, :name_translations_hstore
end
Expand Down
Loading

0 comments on commit d385786

Please sign in to comment.