]> git.openstreetmap.org Git - rails.git/blob - db/migrate/040_create_oauth_tables.rb
Update to rails 6.0.3.7
[rails.git] / db / migrate / 040_create_oauth_tables.rb
1 class CreateOauthTables < ActiveRecord::Migration[4.2]
2   def self.up
3     create_table :client_applications do |t|
4       t.string :name
5       t.string :url
6       t.string :support_url
7       t.string :callback_url
8       t.string :key, :limit => 50
9       t.string :secret, :limit => 50
10       t.integer :user_id
11
12       t.timestamps :null => true
13     end
14     add_index :client_applications, :key, :unique => true
15
16     create_table :oauth_tokens do |t|
17       t.integer :user_id
18       t.string :type, :limit => 20
19       t.integer :client_application_id
20       t.string :token, :limit => 50
21       t.string :secret, :limit => 50
22       t.timestamp :authorized_at, :invalidated_at
23       t.timestamps :null => true
24     end
25
26     add_index :oauth_tokens, :token, :unique => true
27
28     create_table :oauth_nonces do |t|
29       t.string :nonce
30       t.integer :timestamp
31
32       t.timestamps :null => true
33     end
34     add_index :oauth_nonces, [:nonce, :timestamp], :unique => true
35   end
36
37   def self.down
38     drop_table :client_applications
39     drop_table :oauth_tokens
40     drop_table :oauth_nonces
41   end
42 end