summaryrefslogtreecommitdiff
path: root/db/migrate
diff options
context:
space:
mode:
authorKamil TrzciƄski <ayufan@ayufan.eu>2018-12-06 09:42:18 +0000
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2018-12-07 10:42:47 +0100
commita910c09bbc8c56002db10d669e4ae1e4bdef9f4d (patch)
treec297c90f20e68b9b7f9b2dd23e3a0b96df4147e2 /db/migrate
parenta2e06ad3034cd1e007b78514a5c1f47feef7b648 (diff)
downloadgitlab-ce-a910c09bbc8c56002db10d669e4ae1e4bdef9f4d.tar.gz
Encrypt CI/CD builds tokens
Brings back 1e8f1de0 reverted in !23644 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