akkounts/db/migrate/20230312212030_create_remote_storage_authorizations.rb
2023-09-03 15:28:32 +02:00

21 lines
646 B
Ruby

class CreateRemoteStorageAuthorizations < ActiveRecord::Migration[7.0]
def change
db_type = ActiveRecord::Base.configurations.find_db_config(Rails.env).adapter
array_default = db_type == "postgresql" ? [] : [].to_yaml
create_table :remote_storage_authorizations do |t|
t.references :user, null: false, foreign_key: true
t.string :token
t.text :permissions, array: true, default: array_default
t.string :client_id
t.string :redirect_uri
t.string :app_name
t.datetime :expire_at
t.timestamps
end
add_index :remote_storage_authorizations, :permissions, using: 'gin'
end
end