You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
1.7 KiB

  1. class CreateDoorkeeperTables < ActiveRecord::Migration
  2. def change
  3. create_table :oauth_applications do |t|
  4. t.string :name, null: false
  5. t.string :uid, null: false
  6. t.string :secret, null: false
  7. t.text :redirect_uri, null: false
  8. t.string :scopes, null: false, default: ''
  9. t.timestamps
  10. end
  11. add_index :oauth_applications, :uid, unique: true
  12. create_table :oauth_access_grants do |t|
  13. t.integer :resource_owner_id, null: false
  14. t.integer :application_id, null: false
  15. t.string :token, null: false
  16. t.integer :expires_in, null: false
  17. t.text :redirect_uri, null: false
  18. t.datetime :created_at, null: false
  19. t.datetime :revoked_at
  20. t.string :scopes
  21. end
  22. add_index :oauth_access_grants, :token, unique: true
  23. create_table :oauth_access_tokens do |t|
  24. t.integer :resource_owner_id
  25. t.integer :application_id
  26. # If you use a custom token generator you may need to change this column
  27. # from string to text, so that it accepts tokens larger than 255
  28. # characters. More info on custom token generators in:
  29. # https://github.com/doorkeeper-gem/doorkeeper/tree/v3.0.0.rc1#custom-access-token-generator
  30. #
  31. # t.text :token, null: false
  32. t.string :token, null: false
  33. t.string :refresh_token
  34. t.integer :expires_in
  35. t.datetime :revoked_at
  36. t.datetime :created_at, null: false
  37. t.string :scopes
  38. end
  39. add_index :oauth_access_tokens, :token, unique: true
  40. add_index :oauth_access_tokens, :resource_owner_id
  41. add_index :oauth_access_tokens, :refresh_token, unique: true
  42. end
  43. end