2021-09-02 23:31:14 -04:00
|
|
|
defmodule Cannery.Repo.Migrations.CreateContainers do
|
|
|
|
use Ecto.Migration
|
|
|
|
|
|
|
|
def change do
|
|
|
|
create table(:containers, primary_key: false) do
|
|
|
|
add :id, :binary_id, primary_key: true
|
|
|
|
add :name, :string
|
2021-09-12 19:06:26 -04:00
|
|
|
add :desc, :text
|
2021-09-02 23:31:14 -04:00
|
|
|
add :type, :string
|
2021-09-12 19:06:26 -04:00
|
|
|
add :location, :text
|
|
|
|
|
|
|
|
add :user_id, references(:users, on_delete: :delete_all, type: :binary_id)
|
2021-09-02 23:31:14 -04:00
|
|
|
|
|
|
|
timestamps()
|
|
|
|
end
|
|
|
|
|
|
|
|
create index(:containers, [:user_id])
|
|
|
|
end
|
|
|
|
end
|