docbrown/db/migrate/20181219215401_create_api_secrets.rb
Timothy Ng 84bd3a69d7 ApiSecret model for Developer API (#1369)
* Add ApiSecret model scaffold

* Add relationships between ApiSecret, User, Organization

* Add placeholder template to account tab

* Add description column to ApiSecrets

* Add very basic access token generation

* Add basic access token deletion

* Show access token on success flash

* Add placeholder message when user has no secrets

* Use cta style on token generation button

* Add presence validation for ApiSecret description

* Add ApiSecrets factory

* Add pundit policy for ApiSecret

* Nest form field within api_secret hash to allow rails strong params

* Use pundit to authorize ApiSecretController actions

* Add error message flash for ApiSecretsController actions

* Add specs for ApiSecretsController

* Add length validation to api secret description

* Flash model error instead of generic message on save failure

* Truncate ApiSecret factory objects descriptions to prevent validation error

* Remove length restriction on ApiSecret.description

* Use darker font color for token creation date

* Consolidate ApiSecret migrations
2019-01-08 12:30:54 -05:00

13 lines
318 B
Ruby

class CreateApiSecrets < ActiveRecord::Migration[5.1]
def change
create_table :api_secrets do |t|
t.string :secret
t.integer :user_id
t.string :description, null: false
t.timestamps
end
add_index :api_secrets, :secret, unique: true
add_index :api_secrets, :user_id
end
end