Add explicit primary key for ci_builds_metadata table
This commit is contained in:
parent
7008ed1e33
commit
403decbbad
|
@ -11,6 +11,7 @@ module Ci
|
|||
belongs_to :build, class_name: 'Ci::Build'
|
||||
belongs_to :project
|
||||
|
||||
validates :build, presence: true
|
||||
validates :project, presence: true
|
||||
|
||||
chronic_duration_attr_reader :timeout_human_readable, :timeout
|
||||
|
|
|
@ -4,16 +4,16 @@ class CreateCiBuildsMetadataTable < ActiveRecord::Migration
|
|||
DOWNTIME = false
|
||||
|
||||
def change
|
||||
create_table :ci_builds_metadata, id: false do |t|
|
||||
create_table :ci_builds_metadata do |t|
|
||||
t.integer :build_id, null: false
|
||||
t.integer :project_id, null: false
|
||||
t.integer :timeout
|
||||
t.integer :timeout_source, null: false, default: 1
|
||||
|
||||
t.primary_key :build_id
|
||||
t.foreign_key :ci_builds, column: :build_id, on_delete: :cascade
|
||||
t.foreign_key :projects, column: :project_id, on_delete: :cascade
|
||||
|
||||
t.index :build_id, unique: true
|
||||
t.index :project_id
|
||||
end
|
||||
end
|
||||
|
|
|
@ -329,12 +329,14 @@ ActiveRecord::Schema.define(version: 20180327101207) do
|
|||
add_index "ci_builds", ["updated_at"], name: "index_ci_builds_on_updated_at", using: :btree
|
||||
add_index "ci_builds", ["user_id"], name: "index_ci_builds_on_user_id", using: :btree
|
||||
|
||||
create_table "ci_builds_metadata", primary_key: "build_id", force: :cascade do |t|
|
||||
create_table "ci_builds_metadata", force: :cascade do |t|
|
||||
t.integer "build_id", null: false
|
||||
t.integer "project_id", null: false
|
||||
t.integer "timeout"
|
||||
t.integer "timeout_source", default: 1, null: false
|
||||
end
|
||||
|
||||
add_index "ci_builds_metadata", ["build_id"], name: "index_ci_builds_metadata_on_build_id", unique: true, using: :btree
|
||||
add_index "ci_builds_metadata", ["project_id"], name: "index_ci_builds_metadata_on_project_id", using: :btree
|
||||
|
||||
create_table "ci_group_variables", force: :cascade do |t|
|
||||
|
|
Loading…
Reference in New Issue