mirror of
https://github.com/plausible/analytics.git
synced 2024-11-30 00:58:54 +03:00
31 lines
612 B
Elixir
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
|