summaryrefslogtreecommitdiff
path: root/db/migrate/20180319190020_create_deploy_tokens.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20180319190020_create_deploy_tokens.rb')
-rw-r--r--db/migrate/20180319190020_create_deploy_tokens.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb
new file mode 100644
index 00000000000..d129459ea0a
--- /dev/null
+++ b/db/migrate/20180319190020_create_deploy_tokens.rb
@@ -0,0 +1,19 @@
+class CreateDeployTokens < ActiveRecord::Migration
+ DOWNTIME = false
+
+ def change
+ create_table :deploy_tokens do |t|
+ t.boolean :revoked, default: false
+ t.boolean :read_repository, null: false, default: false
+ t.boolean :read_registry, null: false, default: false
+
+ t.datetime_with_timezone :expires_at, null: false
+ t.datetime_with_timezone :created_at, null: false
+
+ t.string :name, null: false
+ t.string :token, index: { unique: true }, null: false
+
+ t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)"
+ end
+ end
+end