mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 11:13:22 +08:00
Migrate many old moderation action posts to small actions
This commit is contained in:
parent
33b03c1503
commit
212c0fd87b
|
@ -129,6 +129,9 @@ en:
|
|||
pinned:
|
||||
enabled: 'pinned this topic %{when}'
|
||||
disabled: 'unpinned this topic %{when}'
|
||||
pinned_globally:
|
||||
enabled: 'pinned this topic %{when}'
|
||||
disabled: 'unpinned this topic %{when}'
|
||||
visible:
|
||||
enabled: 'unlisted this topic %{when}'
|
||||
disabled: 'listed this topic %{when}'
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
class CreateUserFieldOptions < ActiveRecord::Migration
|
||||
def change
|
||||
create_table :user_field_options do |t|
|
||||
create_table :user_field_options, force: true do |t|
|
||||
t.references :user_field, null: false
|
||||
t.string :value, null: false
|
||||
t.timestamps
|
||||
|
|
19
db/migrate/20150728210202_migrate_old_moderator_posts.rb
Normal file
19
db/migrate/20150728210202_migrate_old_moderator_posts.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
class MigrateOldModeratorPosts < ActiveRecord::Migration
|
||||
|
||||
def migrate_key(action_code)
|
||||
text = I18n.t("topic_statuses.#{action_code.gsub('.', '_')}")
|
||||
|
||||
execute "UPDATE posts SET action_code = '#{action_code}', raw = '', cooked = '', post_type = 3 where post_type = 2 AND raw = #{ActiveRecord::Base.connection.quote(text)}"
|
||||
end
|
||||
|
||||
def up
|
||||
migrate_key('closed.enabled')
|
||||
migrate_key('closed.disabled')
|
||||
migrate_key('archived.enabled')
|
||||
migrate_key('archived.disabled')
|
||||
migrate_key('pinned.enabled')
|
||||
migrate_key('pinned.disabled')
|
||||
migrate_key('pinned_globally.enabled')
|
||||
migrate_key('pinned_globally.disabled')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue
Block a user