2018-12-13 14:17:19 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2018-12-17 12:37:32 -05:00
|
|
|
class CreateSuggestions < ActiveRecord::Migration[5.0]
|
2018-12-13 14:17:19 -05:00
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
def change
|
|
|
|
create_table :suggestions, id: :bigserial do |t|
|
|
|
|
t.references :note, foreign_key: { on_delete: :cascade }, null: false
|
|
|
|
t.integer :relative_order, null: false, limit: 2
|
|
|
|
t.boolean :applied, null: false, default: false
|
2019-08-23 17:36:12 -04:00
|
|
|
t.string :commit_id # rubocop:disable Migration/AddLimitToStringColumns
|
2018-12-13 14:17:19 -05:00
|
|
|
t.text :from_content, null: false
|
|
|
|
t.text :to_content, null: false
|
|
|
|
|
|
|
|
t.index [:note_id, :relative_order],
|
|
|
|
name: 'index_suggestions_on_note_id_and_relative_order',
|
|
|
|
unique: true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|