2018-03-19 12:11:12 -04:00
|
|
|
class CreateDeployTokens < ActiveRecord::Migration
|
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
def change
|
|
|
|
create_table :deploy_tokens do |t|
|
|
|
|
t.boolean :revoked, default: false
|
2018-04-05 17:37:39 -04:00
|
|
|
t.boolean :read_repository, null: false, default: false
|
|
|
|
t.boolean :read_registry, null: false, default: false
|
2018-03-19 12:11:12 -04:00
|
|
|
|
2018-04-06 12:23:45 -04:00
|
|
|
t.datetime_with_timezone :expires_at, null: false
|
2018-04-06 10:30:21 -04:00
|
|
|
t.datetime_with_timezone :created_at, null: false
|
2018-04-05 17:37:39 -04:00
|
|
|
|
|
|
|
t.string :name, null: false
|
|
|
|
t.string :token, index: { unique: true }, null: false
|
2018-04-06 10:30:21 -04:00
|
|
|
|
2018-04-06 14:54:39 -04:00
|
|
|
t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)"
|
2018-03-19 12:11:12 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|