20180319190020_create_deploy_tokens.rb 588 Bytes
Newer Older
1
class CreateDeployTokens < ActiveRecord::Migration[4.2]
2 3 4 5 6
  DOWNTIME = false

  def change
    create_table :deploy_tokens do |t|
      t.boolean :revoked, default: false
7 8
      t.boolean :read_repository, null: false, default: false
      t.boolean :read_registry, null: false, default: false
9

10
      t.datetime_with_timezone :expires_at, null: false
11
      t.datetime_with_timezone :created_at, null: false
12 13 14

      t.string :name, null: false
      t.string :token, index: { unique: true }, null: false
15

16
      t.index [:token, :expires_at, :id], where: "(revoked IS FALSE)"
17 18 19
    end
  end
end