mirror of
https://github.com/discourse/discourse.git
synced 2025-02-17 03:42:45 +08:00
rename on_remove, on_drop
This commit is contained in:
parent
81326f85e5
commit
7a15b44ac3
|
@ -30,7 +30,7 @@ ColumnDropper.drop(
|
|||
table: 'categories',
|
||||
after_migration: 'AddUploadsToCategories',
|
||||
columns: ['logo_url', 'background_url'],
|
||||
on_remove: ->(){
|
||||
on_drop: ->(){
|
||||
STDERR.puts 'Removing superflous categories columns!'
|
||||
}
|
||||
)
|
||||
|
|
|
@ -49,7 +49,7 @@ ColumnDropper.drop(
|
|||
last_redirected_to_top_at
|
||||
auth_token
|
||||
auth_token_updated_at ],
|
||||
on_remove: ->(){
|
||||
on_drop: ->(){
|
||||
STDERR.puts 'Removing superflous users columns!'
|
||||
}
|
||||
)
|
||||
|
|
|
@ -22,7 +22,7 @@ ColumnDropper.drop(
|
|||
table: 'theme_fields',
|
||||
after_migration: 'AddUploadIdToThemeFields',
|
||||
columns: ['target'],
|
||||
on_remove: ->(){
|
||||
on_drop: ->(){
|
||||
STDERR.puts 'Removing superflous theme_fields target column!'
|
||||
}
|
||||
)
|
||||
|
|
|
@ -78,7 +78,7 @@ ColumnDropper.drop(
|
|||
illegal_count
|
||||
notify_user_count
|
||||
},
|
||||
on_remove: ->(){
|
||||
on_drop: ->(){
|
||||
STDERR.puts "Removing superflous topic columns!"
|
||||
}
|
||||
)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
class ColumnDropper
|
||||
def self.drop(table:, after_migration:, columns:, delay: nil, on_remove: nil)
|
||||
def self.drop(table:, after_migration:, columns:, delay: nil, on_drop: nil)
|
||||
raise ArgumentError.new("Invalid table name passed to drop #{table}") if table =~ /[^a-z0-9_]/i
|
||||
|
||||
columns.each do |column|
|
||||
|
@ -27,7 +27,7 @@ SQL
|
|||
columns: columns,
|
||||
delay: "#{delay.to_i || 0} seconds",
|
||||
after_migration: after_migration).to_a.length > 0
|
||||
on_remove&.call
|
||||
on_drop&.call
|
||||
|
||||
columns.each do |column|
|
||||
# safe cause it is protected on method entry, can not be passed in params
|
||||
|
|
|
@ -30,7 +30,7 @@ describe ColumnDropper do
|
|||
after_migration: name,
|
||||
columns: ['junk'],
|
||||
delay: 20.minutes,
|
||||
on_remove: ->(){dropped_proc_called = true}
|
||||
on_drop: ->(){dropped_proc_called = true}
|
||||
)
|
||||
|
||||
expect(has_column?('topics', 'junk')).to eq(true)
|
||||
|
@ -41,7 +41,7 @@ describe ColumnDropper do
|
|||
after_migration: name,
|
||||
columns: ['junk'],
|
||||
delay: 10.minutes,
|
||||
on_remove: ->(){dropped_proc_called = true}
|
||||
on_drop: ->(){dropped_proc_called = true}
|
||||
)
|
||||
|
||||
expect(has_column?('topics', 'junk')).to eq(false)
|
||||
|
|
Loading…
Reference in New Issue
Block a user