diff options
author | Shinya Maeda <shinya@gitlab.com> | 2017-06-21 18:25:01 +0900 |
---|---|---|
committer | Shinya Maeda <shinya@gitlab.com> | 2017-07-05 18:36:18 +0900 |
commit | d278da48f837292491aaf81649afef1da3a1eb09 (patch) | |
tree | 3af83b99d6e6c2b503d1a73f0ac61604edf375ee /db | |
parent | 5af1fcd6f329858d757bab0d67cb50af6c820160 (diff) | |
download | gitlab-ce-d278da48f837292491aaf81649afef1da3a1eb09.tar.gz |
pipeline_schedule_variables model/db
Diffstat (limited to 'db')
-rw-r--r-- | db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb | 25 | ||||
-rw-r--r-- | db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb | 15 | ||||
-rw-r--r-- | db/schema.rb | 14 |
3 files changed, 54 insertions, 0 deletions
diff --git a/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb b/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb new file mode 100644 index 00000000000..7d2d313a91a --- /dev/null +++ b/db/migrate/20170620064728_create_ci_pipeline_schedule_variables.rb @@ -0,0 +1,25 @@ +class CreateCiPipelineScheduleVariables < ActiveRecord::Migration + DOWNTIME = false + + def up + create_table :ci_pipeline_schedule_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_schedule_id, null: false + + t.timestamps null: false + end + + add_index :ci_pipeline_schedule_variables, + [:pipeline_schedule_id, :key], + name: "index_ci_pipeline_schedule_variables_on_schedule_id_and_key", + unique: true + end + + def down + drop_table :ci_pipeline_schedule_variables + end +end diff --git a/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb b/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb new file mode 100644 index 00000000000..7bbf66e0ac3 --- /dev/null +++ b/db/migrate/20170620065449_add_foreign_key_to_ci_pipeline_schedule_variables.rb @@ -0,0 +1,15 @@ +class AddForeignKeyToCiPipelineScheduleVariables < ActiveRecord::Migration + include Gitlab::Database::MigrationHelpers + + DOWNTIME = false + + disable_ddl_transaction! + + def up + add_concurrent_foreign_key(:ci_pipeline_schedule_variables, :ci_pipeline_schedules, column: :pipeline_schedule_id) + end + + def down + remove_foreign_key(:ci_pipeline_schedule_variables, column: :pipeline_schedule_id) + end +end diff --git a/db/schema.rb b/db/schema.rb index 993eea1f642..a2c21e80c19 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -253,6 +253,19 @@ ActiveRecord::Schema.define(version: 20170623080805) 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_pipeline_schedule_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_schedule_id", null: false + t.datetime "created_at", null: false + t.datetime "updated_at", null: false + end + + add_index "ci_pipeline_schedule_variables", ["pipeline_schedule_id", "key"], name: "index_ci_pipeline_schedule_variables_on_schedule_id_and_key", unique: true, using: :btree + create_table "ci_pipeline_schedules", force: :cascade do |t| t.string "description" t.string "ref" @@ -1531,6 +1544,7 @@ ActiveRecord::Schema.define(version: 20170623080805) do add_foreign_key "chat_teams", "namespaces", on_delete: :cascade 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_pipeline_schedule_variables", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_41c35fda51", 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_pipelines", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_3d34ab2e06", on_delete: :nullify |