add shops context, clothes and users-clothes
users-clothes is a many-to-many unique relationship
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user