add shops context, clothes and users-clothes

users-clothes is a many-to-many unique relationship
This commit is contained in:
2021-06-28 16:32:25 +02:00
parent 28823a6972
commit 4f8b87a2d9
14 changed files with 454 additions and 0 deletions
@@ -0,0 +1,21 @@
defmodule PokemonCouture.Repo.Migrations.CreateClothes do
use Ecto.Migration
def change do
create table(:clothes) do
add :name, :string
add :location, :string
add :game, :string
timestamps()
end
create table(:ownerships, primary_key: false) do
add :user_id, references(:users)
add :clothes_id, references(:clothes)
end
create unique_index(:ownerships, [:user_id, :clothes_id])
end
end