2018-11-13 02:27:31 -05:00
|
|
|
class CreateDeployTokens < ActiveRecord::Migration[4.2]
|
2018-03-19 12:11:12 -04:00
|
|
|
DOWNTIME = false
|
|
|
|
|
|
|
|
def change
|
2019-08-23 17:36:12 -04:00
|
|
|
# rubocop:disable Migration/AddLimitToStringColumns
|
2018-03-19 12:11:12 -04:00
|
|
|
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
|
2019-08-23 17:36:12 -04:00
|
|
|
# rubocop:enable Migration/AddLimitToStringColumns
|
2018-03-19 12:11:12 -04:00
|
|
|
end
|
|
|
|
end
|