1 # frozen_string_literal: true
 
   3 class CreateOauthTables < ActiveRecord::Migration[4.2]
 
   5     create_table :client_applications do |t|
 
  10       t.string :key, :limit => 50
 
  11       t.string :secret, :limit => 50
 
  14       t.timestamps :null => true
 
  16     add_index :client_applications, :key, :unique => true
 
  18     create_table :oauth_tokens do |t|
 
  20       t.string :type, :limit => 20
 
  21       t.integer :client_application_id
 
  22       t.string :token, :limit => 50
 
  23       t.string :secret, :limit => 50
 
  24       t.timestamp :authorized_at, :invalidated_at
 
  25       t.timestamps :null => true
 
  28     add_index :oauth_tokens, :token, :unique => true
 
  30     create_table :oauth_nonces do |t|
 
  34       t.timestamps :null => true
 
  36     add_index :oauth_nonces, [:nonce, :timestamp], :unique => true
 
  40     drop_table :client_applications
 
  41     drop_table :oauth_tokens
 
  42     drop_table :oauth_nonces