summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-12-06 09:42:18 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2018-12-06 09:42:18 +0000
commit1e8f1de034aa9b6a60b640b2b091f60c4d3ba365 (patch)
treeabd80e929711138c27e065589e5285abe52ed314 /db/migrate
parent62d971129da99936a3cdc04f3740d26f16a0c7a6 (diff)
parent73f872448b59600eca792f9a34e2c8bfa976afde (diff)
downloadgitlab-ce-1e8f1de034aa9b6a60b640b2b091f60c4d3ba365.tar.gz
Merge branch 'fix/gb/encrypt-ci-build-token' into 'master'
Encrypt CI/CD builds tokens Closes #52342 See merge request gitlab-org/gitlab-ce!23436
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb11
-rw-r--r--db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb17
2 files changed, 28 insertions, 0 deletions
diff --git a/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb b/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb
new file mode 100644
index 00000000000..11b98203793
--- /dev/null
+++ b/db/migrate/20181129104854_add_token_encrypted_to_ci_builds.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class AddTokenEncryptedToCiBuilds < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ def change
+ add_column :ci_builds, :token_encrypted, :string
+ end
+end
diff --git a/db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb b/db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb
new file mode 100644
index 00000000000..f90aca008e5
--- /dev/null
+++ b/db/migrate/20181129104944_add_index_to_ci_builds_token_encrypted.rb
@@ -0,0 +1,17 @@
+# frozen_string_literal: true
+
+class AddIndexToCiBuildsTokenEncrypted < ActiveRecord::Migration[5.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ add_concurrent_index :ci_builds, :token_encrypted, unique: true, where: 'token_encrypted IS NOT NULL'
+ end
+
+ def down
+ remove_concurrent_index :ci_builds, :token_encrypted
+ end
+end