mirror of
https://github.com/discourse/discourse.git
synced 2024-11-26 22:43:43 +08:00
6a3c8fe69c
Often we need to amend our schema, it is tempting to use drop_table, rename_column and drop_column to amned schema trouble though is that existing code that is running in production can depend on the existance of previous schema leading to application breaking until new code base is deployed. The commit enforces new rules to ensure we can never drop tables or columns in migrations and instead use Migration::ColumnDropper and Migration::TableDropper to defer drop the db objects
16 lines
412 B
Ruby
16 lines
412 B
Ruby
Group.ensure_automatic_groups!
|
|
if g = Group.find_by(name: 'trust_level_5', id: 15)
|
|
g.destroy!
|
|
end
|
|
|
|
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!'
|
|
}
|
|
)
|