2021-06-28 16:32:25 +02:00
|
|
|
defmodule PokemonCouture.Repo.Migrations.CreateClothes do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:clothes) do
|
|
|
|
add :name, :string
|
2021-06-30 14:03:08 +02:00
|
|
|
add :color, :string
|
2021-09-24 14:43:41 +02:00
|
|
|
add :type, :string
|
2021-06-28 16:32:25 +02:00
|
|
|
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
|