Introduce application tokens
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
20
priv/repo/migrations/20230208101626_create_applications.exs
Normal file
20
priv/repo/migrations/20230208101626_create_applications.exs
Normal file
@@ -0,0 +1,20 @@
|
||||
defmodule Mobilizon.Repo.Migrations.CreateApplications do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:applications) do
|
||||
add(:name, :string, null: false)
|
||||
add(:client_id, :string, null: false)
|
||||
add(:client_secret, :string, null: false)
|
||||
add(:redirect_uris, :string, null: false)
|
||||
add(:scopes, :string, null: true)
|
||||
add(:website, :string, null: true)
|
||||
add(:owner_type, :string, null: true)
|
||||
add(:owner_id, :integer, null: true)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(index(:applications, [:owner_id, :owner_type]))
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,14 @@
|
||||
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)
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create(unique_index(:application_tokens, [:user_id, :application_id]))
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user