summaryrefslogtreecommitdiff
path: root/db/migrate/20180214093516_create_badges.rb
blob: 66e017b115ad2525c7fc6fe33c0ea6e612a05aa0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
class CreateBadges < ActiveRecord::Migration[4.2]
  DOWNTIME = false

  def change
    create_table :badges do |t|
      t.string     :link_url, null: false
      t.string     :image_url, null: false
      t.references :project, index: true, foreign_key: { on_delete: :cascade }, null: true
      t.integer    :group_id, index: true, null: true
      t.string     :type, null: false

      t.timestamps_with_timezone null: false
    end

    # rubocop:disable Migration/AddConcurrentForeignKey
    add_foreign_key :badges, :namespaces, column: :group_id, on_delete: :cascade
  end
end