Packages
boruta
0.1.0
3.0.0-beta.4
3.0.0-beta.3
3.0.0-beta.2
3.0.0-beta.1
2.3.6
2.3.5
2.3.4
2.3.3
2.3.2
2.3.1
2.3.0
2.2.2
2.2.1
2.2.0
2.1.5
2.1.4
2.1.3
2.1.2
2.1.1
2.1.0
2.0.1
2.0.0
2.0.0-rc.1
2.0.0-rc.0
1.2.1
1.2.0
1.1.0
1.0.3
1.0.2
1.0.1
1.0.0
1.0.0-rc.3
1.0.0-rc.2
1.0.0-rc.1
1.0.0-rc.0
0.2.1
0.2.0
0.1.1
0.1.0
0.1.0-rc.5
0.1.0-rc.4
0.1.0-rc.3
0.1.0-rc.2
0.1.0-rc.1
Core of an OAuth/OpenID Connect provider enabling authorization in your applications.
Current section
Files
Jump to
Current section
Files
priv/repo/migrations/20191009182339_create_boruta.exs
defmodule Boruta.Repo.Migrations.CreateBoruta do
use Ecto.Migration
def change do
create table(:clients, primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:name, :string)
add(:secret, :string)
add(:redirect_uri, :string)
add(:scope, :string)
add(:authorize_scope, :boolean, default: false)
timestamps()
end
create table(:tokens, primary_key: false) do
add(:id, :uuid, primary_key: true)
add(:type, :string)
add(:value, :string)
add(:refresh_token, :string)
add(:expires_at, :integer)
add(:redirect_uri, :string)
add(:state, :string)
add(:scope, :string)
add(:client_id, references(:clients, type: :uuid, on_delete: :nilify_all))
add(:resource_owner_id, :uuid)
timestamps()
end
create table(:scopes, primary_key: false) do
add :id, :binary_id, primary_key: true
add :name, :string
add :public, :boolean, default: false, null: false
timestamps()
end
create table(:clients_scopes) do
add(:client_id, references(:clients, type: :uuid, on_delete: :delete_all))
add(:scope_id, references(:scopes, type: :uuid, on_delete: :delete_all))
end
create table(:users, primary_key: false) do
add :id, :uuid, primary_key: true
add :name, :string
add :email, :string
add :password_hash, :string
add :reset_password_token, :string
add :reset_password_sent_at, :utc_datetime
add :failed_attempts, :integer, default: 0
add :locked_at, :utc_datetime
add :sign_in_count, :integer, default: 0
add :current_sign_in_at, :utc_datetime
add :last_sign_in_at, :utc_datetime
add :current_sign_in_ip, :string
add :last_sign_in_ip, :string
add :unlock_token, :string
add :email_confirmation_token, :string
add :email_confirmed_at, :utc_datetime
add :unconfirmed_email, :string
timestamps()
end
create table(:scopes_users) do
add(:user_id, references(:users, type: :uuid, on_delete: :delete_all))
add(:scope_id, references(:scopes, type: :uuid, on_delete: :delete_all))
end
create unique_index(:users, :email_confirmation_token)
create unique_index(:users, [:email])
create unique_index(:clients, [:id, :secret])
create unique_index(:clients, [:id, :redirect_uri])
create index("tokens", [:value])
create unique_index("tokens", [:client_id, :value])
create unique_index("tokens", [:client_id, :refresh_token])
create unique_index("scopes", [:name])
end
end