summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authorMatija Čupić <matteeyah@gmail.com>2019-07-29 07:43:10 +0000
committerPhil Hughes <me@iamphill.com>2019-07-29 07:43:10 +0000
commita5aa40c5fe93dc3daba8a578f4c09c4e443fcbec (patch)
tree34eb74d209b1919f78ce70d89ee0900cd2602780 /db
parent946f7c0687760ec49aca582a329d0ec3c7ac3037 (diff)
downloadgitlab-ce-a5aa40c5fe93dc3daba8a578f4c09c4e443fcbec.tar.gz
Add Job specific variables
Adds Job specific variables to facilitate specifying variables when running manual jobs.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190711124721_create_job_variables.rb23
-rw-r--r--db/schema.rb11
2 files changed, 34 insertions, 0 deletions
diff --git a/db/migrate/20190711124721_create_job_variables.rb b/db/migrate/20190711124721_create_job_variables.rb
new file mode 100644
index 00000000000..a860522f39e
--- /dev/null
+++ b/db/migrate/20190711124721_create_job_variables.rb
@@ -0,0 +1,23 @@
+# frozen_string_literal: true
+
+# See http://doc.gitlab.com/ce/development/migration_style_guide.html
+# for more information on how to write migrations for GitLab.
+
+class CreateJobVariables < ActiveRecord::Migration[5.1]
+ include Gitlab::Database::MigrationHelpers
+
+ # Set this constant to true if this migration requires downtime.
+ DOWNTIME = false
+
+ def change
+ create_table :ci_job_variables do |t|
+ t.string :key, null: false
+ t.text :encrypted_value
+ t.string :encrypted_value_iv
+ t.references :job, null: false, index: true, foreign_key: { to_table: :ci_builds, on_delete: :cascade }
+ t.integer :variable_type, null: false, limit: 2, default: 1
+ end
+
+ add_index :ci_job_variables, [:key, :job_id], unique: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 67479937b47..1b5272179f5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -605,6 +605,16 @@ ActiveRecord::Schema.define(version: 2019_07_25_012225) do
t.index ["project_id"], name: "index_ci_job_artifacts_on_project_id"
end
+ create_table "ci_job_variables", force: :cascade do |t|
+ t.string "key", null: false
+ t.text "encrypted_value"
+ t.string "encrypted_value_iv"
+ t.bigint "job_id", null: false
+ t.integer "variable_type", limit: 2, default: 1, null: false
+ t.index ["job_id"], name: "index_ci_job_variables_on_job_id"
+ t.index ["key", "job_id"], name: "index_ci_job_variables_on_key_and_job_id", unique: true
+ end
+
create_table "ci_pipeline_chat_data", force: :cascade do |t|
t.integer "pipeline_id", null: false
t.integer "chat_name_id", null: false
@@ -3637,6 +3647,7 @@ ActiveRecord::Schema.define(version: 2019_07_25_012225) do
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
+ add_foreign_key "ci_job_variables", "ci_builds", column: "job_id", on_delete: :cascade
add_foreign_key "ci_pipeline_chat_data", "chat_names", on_delete: :cascade
add_foreign_key "ci_pipeline_chat_data", "ci_pipelines", column: "pipeline_id", on_delete: :cascade
add_foreign_key "ci_pipeline_schedule_variables", "ci_pipeline_schedules", column: "pipeline_schedule_id", name: "fk_41c35fda51", on_delete: :cascade