discourse/db/migrate/20191017044811_add_draft_backup_tables.rb
2023-01-09 11:59:41 +00:00

25 lines
692 B
Ruby

# frozen_string_literal: true
class AddDraftBackupTables < ActiveRecord::Migration[6.0]
def change
create_table :backup_draft_topics do |t|
t.integer :user_id, null: false
t.integer :topic_id, null: false
t.timestamps
end
create_table :backup_draft_posts do |t|
t.integer :user_id, null: false
t.integer :post_id, null: false
t.string :key, null: false
t.timestamps
end
add_index :backup_draft_posts, %i[user_id key], unique: true
add_index :backup_draft_posts, [:post_id], unique: true
add_index :backup_draft_topics, [:user_id], unique: true
add_index :backup_draft_topics, [:topic_id], unique: true
end
end