Skip to content

Commit

Permalink
borrow migrations for tags, status & people from Phoenix MVP see: dwy…
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonic committed Feb 19, 2020
1 parent 601daff commit bcafb2f
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 0 deletions.
11 changes: 11 additions & 0 deletions priv/repo/migrations/20191113100513_create_tags.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
defmodule App.Repo.Migrations.CreateTags do
use Ecto.Migration

def change do
create table(:tags) do
add :text, :string

timestamps()
end
end
end
11 changes: 11 additions & 0 deletions priv/repo/migrations/20191113100912_create_status.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
defmodule App.Repo.Migrations.CreateStatus do
use Ecto.Migration

def change do
create table(:status) do
add :text, :string

timestamps()
end
end
end
23 changes: 23 additions & 0 deletions priv/repo/migrations/20191113100920_create_people.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
defmodule App.Repo.Migrations.CreatePeople do
use Ecto.Migration

def change do
create table(:people) do
add :username, :binary
add :username_hash, :binary
add :email, :binary
add :email_hash, :binary
add :givenName, :binary
add :familyName, :binary
add :password_hash, :binary
add :key_id, :integer
add :status, references(:status, on_delete: :nothing)
add :tag, references(:tags, on_delete: :nothing)

timestamps()
end

create index(:people, [:status])
create index(:people, [:tag])
end
end
9 changes: 9 additions & 0 deletions priv/repo/migrations/20191113114340_add_person_id_to_tag.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule App.Repo.Migrations.AddPersonIdToTag do
use Ecto.Migration

def change do
alter table(:tags) do
add :person_id, references(:people, on_delete: :nothing)
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
defmodule App.Repo.Migrations.AddPersonIdToStatus do
use Ecto.Migration

def change do
alter table(:status) do
add :person_id, references(:people, on_delete: :nothing)
end
end
end

0 comments on commit bcafb2f

Please sign in to comment.