Welcome to mirror list, hosted at ThFree Co, Russian Federation.

20180515121227_create_notes_diff_files.rb « migrate « db - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5f6dba11ff9a328f0a14f4911e1fae777c149de5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
class CreateNotesDiffFiles < ActiveRecord::Migration[4.2]
  DOWNTIME = false

  disable_ddl_transaction!

  def change
    # rubocop:disable Migration/AddLimitToStringColumns
    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
    # rubocop:enable Migration/AddLimitToStringColumns
  end
end