0fc9f9d3e7
DB schema generated by a migration may look different in rails 4 and 5 (because rails 5 may use different default values). For this reason it's important to explicitly set for which rails version a migration was written for. See https://stackoverflow.com/questions/35929869/activerecordmigration-deprecation-warning-asks-for-rails-version-but-im-no/35930912#35930912
22 lines
713 B
Ruby
22 lines
713 B
Ruby
class CreateNotesDiffFiles < ActiveRecord::Migration[4.2]
|
|
DOWNTIME = false
|
|
|
|
disable_ddl_transaction!
|
|
|
|
def change
|
|
create_table :note_diff_files do |t|
|
|
t.references :diff_note, references: :notes, null: false, index: { unique: true }
|
|
t.text :diff, null: false
|
|
t.boolean :new_file, null: false
|
|
t.boolean :renamed_file, null: false
|
|
t.boolean :deleted_file, null: false
|
|
t.string :a_mode, null: false
|
|
t.string :b_mode, null: false
|
|
t.text :new_path, null: false
|
|
t.text :old_path, null: false
|
|
end
|
|
|
|
# rubocop:disable Migration/AddConcurrentForeignKey
|
|
add_foreign_key :note_diff_files, :notes, column: :diff_note_id, on_delete: :cascade
|
|
end
|
|
end
|