DEV: organise fixture so all drops happen at the end
This commit is contained in:
parent
1e805cfd3e
commit
24c7d2913b
|
@ -25,12 +25,3 @@ if uncat_id == -1 || !Category.exists?(uncat_id)
|
||||||
Category.exec_sql "INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
Category.exec_sql "INSERT INTO site_settings(name, data_type, value, created_at, updated_at)
|
||||||
VALUES ('uncategorized_category_id', 3, #{category_id}, now(), now())"
|
VALUES ('uncategorized_category_id', 3, #{category_id}, now(), now())"
|
||||||
end
|
end
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'categories',
|
|
||||||
after_migration: 'AddSuppressFromLatestToCategories',
|
|
||||||
columns: ['logo_url', 'background_url', 'suppress_from_homepage'],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing superflous categories columns!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
|
@ -4,12 +4,3 @@ if g = Group.find_by(name: 'trust_level_5', id: 15)
|
||||||
end
|
end
|
||||||
|
|
||||||
Group.where(name: 'everyone').update_all(visibility_level: Group.visibility_levels[:owners])
|
Group.where(name: 'everyone').update_all(visibility_level: Group.visibility_levels[:owners])
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'groups',
|
|
||||||
after_migration: 'SplitAliasLevels',
|
|
||||||
columns: %w[visible public alias_level],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing superflous visible group column!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
|
@ -33,78 +33,6 @@ UserOption.where(user_id: -1).update_all(
|
||||||
|
|
||||||
Group.user_trust_level_change!(-1, TrustLevel[4])
|
Group.user_trust_level_change!(-1, TrustLevel[4])
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'users',
|
|
||||||
after_migration: 'DropEmailFromUsers',
|
|
||||||
columns: %w[
|
|
||||||
email
|
|
||||||
email_always
|
|
||||||
mailing_list_mode
|
|
||||||
email_digests
|
|
||||||
email_direct
|
|
||||||
email_private_messages
|
|
||||||
external_links_in_new_tab
|
|
||||||
enable_quoting
|
|
||||||
dynamic_favicon
|
|
||||||
disable_jump_reply
|
|
||||||
edit_history_public
|
|
||||||
automatically_unpin_topics
|
|
||||||
digest_after_days
|
|
||||||
auto_track_topics_after_msecs
|
|
||||||
new_topic_duration_minutes
|
|
||||||
last_redirected_to_top_at
|
|
||||||
auth_token
|
|
||||||
auth_token_updated_at
|
|
||||||
],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing superflous users columns!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'users',
|
|
||||||
after_migration: 'RenameBlockedSilence',
|
|
||||||
columns: %w[
|
|
||||||
blocked
|
|
||||||
],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing user blocked column!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'users',
|
|
||||||
after_migration: 'AddSilencedTillToUsers',
|
|
||||||
columns: %w[
|
|
||||||
silenced
|
|
||||||
],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing user silenced column!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'users',
|
|
||||||
after_migration: 'AddTrustLevelLocksToUsers',
|
|
||||||
columns: %w[
|
|
||||||
trust_level_locked
|
|
||||||
],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing user trust_level_locked!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'user_auth_tokens',
|
|
||||||
after_migration: 'RemoveLegacyAuthToken',
|
|
||||||
columns: %w[
|
|
||||||
legacy
|
|
||||||
],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing user_auth_token legacy column!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
# User for the smoke tests
|
# User for the smoke tests
|
||||||
if ENV["SMOKE"] == "1"
|
if ENV["SMOKE"] == "1"
|
||||||
UserEmail.seed do |ue|
|
UserEmail.seed do |ue|
|
||||||
|
|
|
@ -17,12 +17,3 @@ if !Theme.exists?
|
||||||
|
|
||||||
default_theme.set_default!
|
default_theme.set_default!
|
||||||
end
|
end
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'theme_fields',
|
|
||||||
after_migration: 'AddUploadIdToThemeFields',
|
|
||||||
columns: ['target'],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts 'Removing superflous theme_fields target column!'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
|
@ -61,49 +61,3 @@ if seed_welcome_topics
|
||||||
skip_validations: true,
|
skip_validations: true,
|
||||||
category: staff ? staff.name : nil)
|
category: staff ? staff.name : nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
# run this later, cause we need to make sure new application controller resilience is in place first
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'user_stats',
|
|
||||||
after_migration: 'DropUnreadTrackingColumns',
|
|
||||||
columns: %w{
|
|
||||||
first_topic_unread_at
|
|
||||||
},
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts "Removing superflous user stats columns!"
|
|
||||||
ActiveRecord::Base.exec_sql "DROP FUNCTION IF EXISTS first_unread_topic_for(int)"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'topics',
|
|
||||||
after_migration: 'DropUnreadTrackingColumns',
|
|
||||||
columns: %w{
|
|
||||||
inappropriate_count
|
|
||||||
bookmark_count
|
|
||||||
off_topic_count
|
|
||||||
illegal_count
|
|
||||||
notify_user_count
|
|
||||||
last_unread_at
|
|
||||||
},
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts "Removing superflous topic columns!"
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'topics',
|
|
||||||
after_migration: 'RemoveAutoCloseColumnsFromTopics',
|
|
||||||
columns: %w{
|
|
||||||
auto_close_at
|
|
||||||
auto_close_user_id
|
|
||||||
auto_close_started_at
|
|
||||||
auto_close_based_on_last_post
|
|
||||||
auto_close_hours
|
|
||||||
},
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts "Removing superflous topic columns!"
|
|
||||||
},
|
|
||||||
delay: 3600
|
|
||||||
)
|
|
|
@ -2,6 +2,159 @@
|
||||||
|
|
||||||
require 'migration/table_dropper'
|
require 'migration/table_dropper'
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'user_profiles',
|
||||||
|
after_migration: 'DropUserCardBadgeColumns',
|
||||||
|
columns: ['card_image_badge_id'],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts "Removing user_profiles column card_image_badge_id"
|
||||||
|
},
|
||||||
|
delay: 3600
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'categories',
|
||||||
|
after_migration: 'AddSuppressFromLatestToCategories',
|
||||||
|
columns: ['logo_url', 'background_url', 'suppress_from_homepage'],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing superflous categories columns!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'groups',
|
||||||
|
after_migration: 'SplitAliasLevels',
|
||||||
|
columns: %w[visible public alias_level],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing superflous visible group column!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'theme_fields',
|
||||||
|
after_migration: 'AddUploadIdToThemeFields',
|
||||||
|
columns: ['target'],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing superflous theme_fields target column!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'user_stats',
|
||||||
|
after_migration: 'DropUnreadTrackingColumns',
|
||||||
|
columns: %w{
|
||||||
|
first_topic_unread_at
|
||||||
|
},
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts "Removing superflous user stats columns!"
|
||||||
|
ActiveRecord::Base.exec_sql "DROP FUNCTION IF EXISTS first_unread_topic_for(int)"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'topics',
|
||||||
|
after_migration: 'DropUnreadTrackingColumns',
|
||||||
|
columns: %w{
|
||||||
|
inappropriate_count
|
||||||
|
bookmark_count
|
||||||
|
off_topic_count
|
||||||
|
illegal_count
|
||||||
|
notify_user_count
|
||||||
|
last_unread_at
|
||||||
|
},
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts "Removing superflous topic columns!"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'topics',
|
||||||
|
after_migration: 'RemoveAutoCloseColumnsFromTopics',
|
||||||
|
columns: %w{
|
||||||
|
auto_close_at
|
||||||
|
auto_close_user_id
|
||||||
|
auto_close_started_at
|
||||||
|
auto_close_based_on_last_post
|
||||||
|
auto_close_hours
|
||||||
|
},
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts "Removing superflous topic columns!"
|
||||||
|
},
|
||||||
|
delay: 3600
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'users',
|
||||||
|
after_migration: 'DropEmailFromUsers',
|
||||||
|
columns: %w[
|
||||||
|
email
|
||||||
|
email_always
|
||||||
|
mailing_list_mode
|
||||||
|
email_digests
|
||||||
|
email_direct
|
||||||
|
email_private_messages
|
||||||
|
external_links_in_new_tab
|
||||||
|
enable_quoting
|
||||||
|
dynamic_favicon
|
||||||
|
disable_jump_reply
|
||||||
|
edit_history_public
|
||||||
|
automatically_unpin_topics
|
||||||
|
digest_after_days
|
||||||
|
auto_track_topics_after_msecs
|
||||||
|
new_topic_duration_minutes
|
||||||
|
last_redirected_to_top_at
|
||||||
|
auth_token
|
||||||
|
auth_token_updated_at
|
||||||
|
],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing superflous users columns!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'users',
|
||||||
|
after_migration: 'RenameBlockedSilence',
|
||||||
|
columns: %w[
|
||||||
|
blocked
|
||||||
|
],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing user blocked column!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'users',
|
||||||
|
after_migration: 'AddSilencedTillToUsers',
|
||||||
|
columns: %w[
|
||||||
|
silenced
|
||||||
|
],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing user silenced column!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'users',
|
||||||
|
after_migration: 'AddTrustLevelLocksToUsers',
|
||||||
|
columns: %w[
|
||||||
|
trust_level_locked
|
||||||
|
],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing user trust_level_locked!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
Migration::ColumnDropper.drop(
|
||||||
|
table: 'user_auth_tokens',
|
||||||
|
after_migration: 'RemoveLegacyAuthToken',
|
||||||
|
columns: %w[
|
||||||
|
legacy
|
||||||
|
],
|
||||||
|
on_drop: ->() {
|
||||||
|
STDERR.puts 'Removing user_auth_token legacy column!'
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
Migration::TableDropper.delayed_rename(
|
Migration::TableDropper.delayed_rename(
|
||||||
old_name: 'topic_status_updates',
|
old_name: 'topic_status_updates',
|
||||||
new_name: 'topic_timers',
|
new_name: 'topic_timers',
|
||||||
|
@ -26,13 +179,3 @@ Migration::TableDropper.delayed_drop(
|
||||||
STDERR.puts "Dropping versions. It isn't used anymore."
|
STDERR.puts "Dropping versions. It isn't used anymore."
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
Migration::ColumnDropper.drop(
|
|
||||||
table: 'user_profiles',
|
|
||||||
after_migration: 'DropUserCardBadgeColumns',
|
|
||||||
columns: ['card_image_badge_id'],
|
|
||||||
on_drop: ->() {
|
|
||||||
STDERR.puts "Removing user_profiles column card_image_badge_id"
|
|
||||||
},
|
|
||||||
delay: 3600
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in New Issue