mirror of
https://github.com/discourse/discourse.git
synced 2025-06-04 11:11:13 +08:00
DEV: lint against Layout/EmptyLineBetweenDefs (#24914)
This commit is contained in:
@ -7,6 +7,7 @@ class AddUsernameLowerToUsers < ActiveRecord::Migration[4.2]
|
||||
add_index :users, [:username_lower], unique: true
|
||||
change_column :users, :username_lower, :string, limit: 20, null: false
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :users, :username_lower
|
||||
end
|
||||
|
@ -16,6 +16,7 @@ class CreatePostActions < ActiveRecord::Migration[4.2]
|
||||
execute "create unique index idx_unique_actions on
|
||||
post_actions(user_id, post_action_type_id, post_id) where deleted_at is null"
|
||||
end
|
||||
|
||||
def down
|
||||
drop_table :post_actions
|
||||
end
|
||||
|
@ -4,6 +4,7 @@ class AddTrackingToTopicUsers < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute "update topic_users set notification_level = 3 where notification_level = 2"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "update topic_users set notification_level = 2 where notification_level = 3"
|
||||
end
|
||||
|
@ -4,6 +4,7 @@ class AddIpAddressToUsers < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
execute "alter table users add column ip_address inet"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "alter table users drop column ip_address"
|
||||
end
|
||||
|
@ -6,6 +6,7 @@ class AddCustomEmailInToCategories < ActiveRecord::Migration[4.2]
|
||||
add_column :categories, :email_in_allow_strangers, :boolean, default: false
|
||||
add_index :categories, :email_in, unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
remove_column :categories, :email_in
|
||||
remove_column :categories, :email_in_allow_strangers
|
||||
|
@ -5,6 +5,7 @@ class PrivateMessagesHaveNoCategoryId < ActiveRecord::Migration[4.2]
|
||||
execute "UPDATE topics SET category_id = NULL WHERE category_id IS NOT NULL AND archetype = \'private_message\'"
|
||||
execute "ALTER TABLE topics ADD CONSTRAINT pm_has_no_category CHECK (category_id IS NULL OR archetype <> 'private_message')"
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
|
@ -5,6 +5,7 @@ class FlushApplicationRequests < ActiveRecord::Migration[4.2]
|
||||
# flush as enum changed
|
||||
execute "TRUNCATE TABLE application_requests"
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
||||
|
@ -4,6 +4,7 @@ class EnlargeUsersEmailField < ActiveRecord::Migration[4.2]
|
||||
def up
|
||||
change_column :users, :email, :string, limit: 513
|
||||
end
|
||||
|
||||
def down
|
||||
change_column :users, :email, :string, limit: 128
|
||||
end
|
||||
|
@ -8,6 +8,7 @@ class ShortenTopicCustomFieldsIndex < ActiveRecord::Migration[4.2]
|
||||
name: "topic_custom_fields_value_key_idx",
|
||||
where: "value IS NOT NULL AND char_length(value) < 400"
|
||||
end
|
||||
|
||||
def down
|
||||
remove_index :topic_custom_fields, :value, name: "topic_custom_fields_value_key_idx"
|
||||
add_index :topic_custom_fields, :value
|
||||
|
@ -4,6 +4,7 @@ class AddSkippedCreatedAtUserIdIndexOnEmailLogs < ActiveRecord::Migration[5.1]
|
||||
def up
|
||||
execute "CREATE INDEX idx_email_logs_user_created_filtered ON email_logs(user_id, created_at) WHERE skipped = 'f'"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "DROP INDEX idx_email_logs_user_created_filtered"
|
||||
end
|
||||
|
@ -7,6 +7,7 @@ class AddSuppressFromLatestToCategories < ActiveRecord::Migration[5.1]
|
||||
UPDATE categories SET suppress_from_latest = suppress_from_homepage
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
raise "can not be removed"
|
||||
end
|
||||
|
@ -13,6 +13,7 @@ class AddIndexToTags < ActiveRecord::Migration[5.2]
|
||||
|
||||
add_index :tags, "lower(name)", unique: true
|
||||
end
|
||||
|
||||
def down
|
||||
raise ActiveRecord::IrreversibleMigration
|
||||
end
|
||||
|
@ -14,6 +14,7 @@ class AddThemeIdToJavascriptCache < ActiveRecord::Migration[5.2]
|
||||
make_changes
|
||||
execute "ALTER TABLE javascript_caches ADD CONSTRAINT enforce_theme_or_theme_field CHECK ((theme_id IS NOT NULL AND theme_field_id IS NULL) OR (theme_id IS NULL AND theme_field_id IS NOT NULL))"
|
||||
end
|
||||
|
||||
def down
|
||||
execute "ALTER TABLE javascript_caches DROP CONSTRAINT enforce_theme_or_theme_field"
|
||||
revert { make_changes }
|
||||
|
@ -7,6 +7,7 @@ class RemoveCanonicalEmailFromUserEmails < ActiveRecord::Migration[6.0]
|
||||
DROP COLUMN IF EXISTS canonical_email
|
||||
SQL
|
||||
end
|
||||
|
||||
def down
|
||||
# nothing to do, we already nuke the migrations
|
||||
end
|
||||
|
Reference in New Issue
Block a user