diff options
author | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-06 17:30:21 +0300 |
---|---|---|
committer | Mayra Cabrera <mcabrera@gitlab.com> | 2018-04-07 05:20:17 +0300 |
commit | 29913816309c6f6387b20c8702bcc8e90ef3a984 (patch) | |
tree | 6dbd8f3367d423a72c0d058d5e1a29296873c1f6 /db/migrate/20180319190020_create_deploy_tokens.rb | |
parent | ca35c65b026e57307a13f25ebc11f11c978ed697 (diff) |
Addresses database comments
- Adds a default on expires_at datetime
- Modifies deploy tokens views to handle default expires at value
- Use datetime_with_timezone where possible
- Remove unused scopes
Diffstat (limited to 'db/migrate/20180319190020_create_deploy_tokens.rb')
-rw-r--r-- | db/migrate/20180319190020_create_deploy_tokens.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/db/migrate/20180319190020_create_deploy_tokens.rb b/db/migrate/20180319190020_create_deploy_tokens.rb index 6a681ba79d6..b8f77f5ae17 100644 --- a/db/migrate/20180319190020_create_deploy_tokens.rb +++ b/db/migrate/20180319190020_create_deploy_tokens.rb @@ -7,11 +7,13 @@ class CreateDeployTokens < ActiveRecord::Migration t.boolean :read_repository, null: false, default: false t.boolean :read_registry, null: false, default: false - t.datetime :expires_at - t.timestamps null: false + t.datetime_with_timezone :expires_at, null: false, default: '3000-01-01' + 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], where: "(revoked IS FALSE)" end end end |