diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2018-03-01 03:12:32 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2018-03-28 13:57:40 +0200 |
commit | 1dde609ca6b130aa0a3d39e929edee7e770e62fc (patch) | |
tree | 5cd6b85eaf9c49e7c14aa23c5c2aa5814f1d955b /db | |
parent | d34e937b93b103435a59e6759a9f30e9f8addc11 (diff) | |
download | gitlab-ce-1dde609ca6b130aa0a3d39e929edee7e770e62fc.tar.gz |
Move job timeout information to new ci_builds_metadata table
Diffstat (limited to 'db')
4 files changed, 36 insertions, 13 deletions
diff --git a/db/migrate/20180221022556_add_used_timeout_and_timeout_source_columns_to_ci_builds.rb b/db/migrate/20180221022556_add_used_timeout_and_timeout_source_columns_to_ci_builds.rb deleted file mode 100644 index 18c4fd5bae4..00000000000 --- a/db/migrate/20180221022556_add_used_timeout_and_timeout_source_columns_to_ci_builds.rb +++ /dev/null @@ -1,10 +0,0 @@ -class AddUsedTimeoutAndTimeoutSourceColumnsToCiBuilds < ActiveRecord::Migration - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - def change - add_column :ci_builds, :used_timeout, :integer - add_column :ci_builds, :timeout_source, :integer - end -end diff --git a/db/migrate/20180301010859_create_ci_builds_metadata_table.rb b/db/migrate/20180301010859_create_ci_builds_metadata_table.rb new file mode 100644 index 00000000000..9d5e9c1779b --- /dev/null +++ b/db/migrate/20180301010859_create_ci_builds_metadata_table.rb @@ -0,0 +1,13 @@ +class CreateCiBuildsMetadataTable < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + def change + create_table :ci_builds_metadata do |t| + t.integer :build_id, null: false + t.integer :used_timeout + t.integer :timeout_source + end + end +end diff --git a/db/migrate/20180301011323_add_build_foreign_key_to_ci_builds_metadata.rb b/db/migrate/20180301011323_add_build_foreign_key_to_ci_builds_metadata.rb new file mode 100644 index 00000000000..feda2d6e9c9 --- /dev/null +++ b/db/migrate/20180301011323_add_build_foreign_key_to_ci_builds_metadata.rb @@ -0,0 +1,15 @@ +class AddBuildForeignKeyToCiBuildsMetadata < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:ci_builds_metadata, :ci_builds, column: :build_id) + end + + def down + remove_foreign_key(:ci_builds_metadata, column: :build_id) + end +end diff --git a/db/schema.rb b/db/schema.rb index 9b126385045..5463b3f1219 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -311,8 +311,6 @@ ActiveRecord::Schema.define(version: 20180327101207) do t.integer "artifacts_metadata_store" t.boolean "protected" t.integer "failure_reason" - t.integer "used_timeout" - t.integer "timeout_source" end add_index "ci_builds", ["artifacts_expire_at"], name: "index_ci_builds_on_artifacts_expire_at", where: "(artifacts_file <> ''::text)", using: :btree @@ -331,6 +329,12 @@ 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", force: :cascade do |t| + t.integer "build_id", null: false + t.integer "used_timeout" + t.integer "timeout_source" + end + create_table "ci_group_variables", force: :cascade do |t| t.string "key", null: false t.text "value" @@ -460,8 +464,8 @@ ActiveRecord::Schema.define(version: 20180327101207) do t.boolean "run_untagged", default: true, null: false t.boolean "locked", default: false, null: false t.integer "access_level", default: 0, null: false - t.string "ip_address" t.integer "maximum_job_timeout" + t.string "ip_address" end add_index "ci_runners", ["contacted_at"], name: "index_ci_runners_on_contacted_at", using: :btree @@ -2031,6 +2035,7 @@ ActiveRecord::Schema.define(version: 20180327101207) do add_foreign_key "ci_builds", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_a2141b1522", on_delete: :nullify add_foreign_key "ci_builds", "ci_stages", column: "stage_id", name: "fk_3a9eaa254d", on_delete: :cascade add_foreign_key "ci_builds", "projects", name: "fk_befce0568a", on_delete: :cascade + add_foreign_key "ci_builds_metadata", "ci_builds", column: "build_id", name: "fk_e20479742e", on_delete: :cascade add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade add_foreign_key "ci_job_artifacts", "ci_builds", column: "job_id", on_delete: :cascade add_foreign_key "ci_job_artifacts", "projects", on_delete: :cascade |