gitlab-org--gitlab-foss/db/migrate/20190722144316_create_milestone_releases_table.rb
Etienne Baqué a43ab8d6a4 Added relationships between Release and Milestone
Modified schema via migrations.
Added one-to-one relationship between the two models.
Added changelog file
2019-09-03 09:38:59 +00:00

20 lines
598 B
Ruby

# frozen_string_literal: true
class CreateMilestoneReleasesTable < ActiveRecord::Migration[5.2]
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
def up
create_table :milestone_releases do |t|
t.references :milestone, foreign_key: { on_delete: :cascade }, null: false, index: false
t.references :release, foreign_key: { on_delete: :cascade }, null: false
end
add_index :milestone_releases, [:milestone_id, :release_id], unique: true, name: 'index_miletone_releases_on_milestone_and_release'
end
def down
drop_table :milestone_releases
end
end