2023-02-15 18:31:23 +00:00
|
|
|
defmodule Mobilizon.Repo.Migrations.CreateApplicationTokens do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:application_tokens) do
|
|
|
|
add(:user_id, references(:users, on_delete: :delete_all), null: false)
|
|
|
|
add(:application_id, references(:applications, on_delete: :delete_all), null: false)
|
|
|
|
add(:authorization_code, :string, null: true)
|
2023-03-17 17:10:59 +00:00
|
|
|
add(:status, :string, default: "pending", null: false)
|
|
|
|
add(:scope, :string)
|
2023-02-15 18:31:23 +00:00
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
create(unique_index(:application_tokens, [:user_id, :application_id]))
|
|
|
|
end
|
|
|
|
end
|