docbrown/db/migrate/20200226205549_create_email_authorization_table.rb
Andy Zhao a3728cfa4c
[deploy] Add EmailAuthorization model (#6335)
* Add EmailAuthorization model

* Add model file oops

* Add comment for uuid type

Co-authored-by: Ben Halpern <bendhalpern@gmail.com>
2020-03-02 12:14:24 -05:00

15 lines
480 B
Ruby

class CreateEmailAuthorizationTable < ActiveRecord::Migration[5.2]
def change
create_table :email_authorizations do |t|
t.references :user
t.jsonb :json_data, null: false, default: {}
t.string :type_of, null: false
t.timestamp :verified_at
t.timestamps null: false
end
add_index :email_authorizations, %i[user_id type_of], unique: true
add_foreign_key :email_authorizations, :users, on_delete: :cascade, validate: false
end
end