analytics/priv/repo/migrations/20190109173917_create_sites.exs
2019-09-02 12:29:19 +01:00

31 lines
612 B
Elixir

defmodule Plausible.Repo.Migrations.CreateSites do
use Ecto.Migration
def change do
create table(:users) do
add :email, :string, null: false
timestamps()
end
create unique_index(:users, :email)
create table(:sites) do
add :domain, :string, null: false
timestamps()
end
create unique_index(:sites, :domain)
create table(:site_memberships) do
add :site_id, references(:sites), null: false
add :user_id, references(:users), null: false
timestamps()
end
create unique_index(:site_memberships, [:site_id, :user_id])
end
end