2023-02-25 15:47:37 -05:00
|
|
|
defmodule Cannery.Repo.Migrations.CreateInvites do
|
2022-02-25 21:52:17 -05:00
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:invites, primary_key: false) do
|
|
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :name, :string
|
|
|
|
add :token, :string
|
|
|
|
add :uses_left, :integer, default: nil
|
|
|
|
add :disabled_at, :naive_datetime, default: nil
|
|
|
|
|
|
|
|
add :user_id, references(:users, on_delete: :delete_all, type: :binary_id)
|
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
create index(:invites, [:user_id])
|
|
|
|
end
|
|
|
|
end
|