diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-07-26 18:31:09 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-28 18:13:29 +0900 |
commit | 56418e85ac6b667d19495665860092ce4d74f55d (patch) | |
tree | 5741323fb221a1ccd30973fd399e50a47c94393c /db | |
parent | 190fae5f0cef11d68c7385be0c4013931796f958 (diff) | |
download | gitlab-ce-56418e85ac6b667d19495665860092ce4d74f55d.tar.gz |
init
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170720130522_create_ci_pipeline_variables.rb | 20 | ||||
-rw-r--r-- | db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 12 |
3 files changed, 47 insertions, 0 deletions
diff --git a/db/migrate/20170720130522_create_ci_pipeline_variables.rb b/db/migrate/20170720130522_create_ci_pipeline_variables.rb new file mode 100644 index 00000000000..a784f5dd142 --- /dev/null +++ b/db/migrate/20170720130522_create_ci_pipeline_variables.rb @@ -0,0 +1,20 @@ +class CreateCiPipelineVariables < ActiveRecord::Migration + DOWNTIME = false + + def up + create_table :ci_pipeline_variables do |t| + t.string :key, null: false + t.text :value + t.text :encrypted_value + t.string :encrypted_value_salt + t.string :encrypted_value_iv + t.integer :pipeline_id, null: false + end + + add_index :ci_pipeline_variables, [:pipeline_id, :key], unique: true + end + + def down + drop_table :ci_pipeline_variables + end +end diff --git a/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb b/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb new file mode 100644 index 00000000000..550b8a88f02 --- /dev/null +++ b/db/migrate/20170720130749_add_foreign_key_to_ci_pipeline_variables.rb @@ -0,0 +1,15 @@ +class AddForeignKeyToCiPipelineVariables < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:ci_pipeline_variables, :ci_pipelines, column: :pipeline_id) + end + + def down + remove_foreign_key(:ci_pipeline_variables, column: :pipeline_id) + end +end diff --git a/db/schema.rb b/db/schema.rb index 93ab79e14e0..0abdb987b77 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -298,6 +298,17 @@ ActiveRecord::Schema.define(version: 20170725145659) do add_index "ci_pipeline_schedules", ["next_run_at", "active"], name: "index_ci_pipeline_schedules_on_next_run_at_and_active", using: :btree add_index "ci_pipeline_schedules", ["project_id"], name: "index_ci_pipeline_schedules_on_project_id", using: :btree + create_table "ci_pipeline_variables", force: :cascade do |t| + t.string "key", null: false + t.text "value" + t.text "encrypted_value" + t.string "encrypted_value_salt" + t.string "encrypted_value_iv" + t.integer "pipeline_id", null: false + end + + add_index "ci_pipeline_variables", ["pipeline_id", "key"], name: "index_ci_pipeline_variables_on_pipeline_id_and_key", unique: true, using: :btree + create_table "ci_pipelines", force: :cascade do |t| t.string "ref" t.string "sha" @@ -1617,6 +1628,7 @@ ActiveRecord::Schema.define(version: 20170725145659) do add_foreign_key "ci_group_variables", "namespaces", column: "group_id", name: "fk_33ae4d58d8", on_delete: :cascade add_foreign_key "ci_pipeline_schedules", "projects", name: "fk_8ead60fcc4", on_delete: :cascade add_foreign_key "ci_pipeline_schedules", "users", column: "owner_id", name: "fk_9ea99f58d2", on_delete: :nullify + add_foreign_key "ci_pipeline_variables", "ci_pipelines", column: "pipeline_id", name: "fk_f29c5f4380", on_delete: :cascade add_foreign_key "ci_pipelines", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_3d34ab2e06", on_delete: :nullify add_foreign_key "ci_pipelines", "ci_pipelines", column: "auto_canceled_by_id", name: "fk_262d4c2d19", on_delete: :nullify add_foreign_key "ci_pipelines", "projects", name: "fk_86635dbd80", on_delete: :cascade |