Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200907021256_create_dast_site_tokens.rb')
-rw-r--r--db/migrate/20200907021256_create_dast_site_tokens.rb34
1 files changed, 34 insertions, 0 deletions
diff --git a/db/migrate/20200907021256_create_dast_site_tokens.rb b/db/migrate/20200907021256_create_dast_site_tokens.rb
new file mode 100644
index 00000000000..a8e221aef69
--- /dev/null
+++ b/db/migrate/20200907021256_create_dast_site_tokens.rb
@@ -0,0 +1,34 @@
+# frozen_string_literal: true
+
+class CreateDastSiteTokens < ActiveRecord::Migration[6.0]
+ include Gitlab::Database::MigrationHelpers
+
+ DOWNTIME = false
+
+ disable_ddl_transaction!
+
+ def up
+ unless table_exists?(:dast_site_tokens)
+ with_lock_retries do
+ create_table :dast_site_tokens do |t|
+ t.references :project, foreign_key: { on_delete: :cascade }, null: false, index: true
+
+ t.timestamps_with_timezone null: false
+ t.datetime_with_timezone :expired_at
+
+ t.text :token, null: false, unique: true
+ t.text :url, null: false
+ end
+ end
+ end
+
+ add_text_limit :dast_site_tokens, :token, 255
+ add_text_limit :dast_site_tokens, :url, 255
+ end
+
+ def down
+ with_lock_retries do
+ drop_table :dast_site_tokens
+ end
+ end
+end