2017-08-31 12:06:56 +08:00
|
|
|
class CreateQueuedPosts < ActiveRecord::Migration[4.2]
|
2015-03-26 02:24:34 +08:00
|
|
|
def change
|
2015-03-27 04:57:50 +08:00
|
|
|
create_table :queued_posts, force: true do |t|
|
2015-03-26 02:24:34 +08:00
|
|
|
t.string :queue, null: false
|
|
|
|
t.integer :state, null: false
|
|
|
|
t.integer :user_id, null: false
|
|
|
|
t.text :raw, null: false
|
2015-03-27 04:57:50 +08:00
|
|
|
t.json :post_options, null: false
|
2015-03-26 02:24:34 +08:00
|
|
|
t.integer :topic_id
|
|
|
|
t.integer :approved_by_id
|
|
|
|
t.timestamp :approved_at
|
|
|
|
t.integer :rejected_by_id
|
|
|
|
t.timestamp :rejected_at
|
2017-08-07 23:48:36 +08:00
|
|
|
t.timestamps null: false
|
2015-03-26 02:24:34 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
add_index :queued_posts, [:queue, :state, :created_at], name: 'by_queue_status'
|
2015-03-27 04:57:50 +08:00
|
|
|
add_index :queued_posts, [:topic_id, :queue, :state, :created_at], name: 'by_queue_status_topic'
|
2015-03-26 02:24:34 +08:00
|
|
|
end
|
|
|
|
end
|