bones73k/priv/repo/migrations/20200914162043_create_properties.exs

18 lines
454 B
Elixir
Raw Normal View History

2021-02-24 07:49:39 -05:00
defmodule Bones73k.Repo.Migrations.CreateProperties do
2020-09-14 12:22:25 -04:00
use Ecto.Migration
def change do
2021-03-05 12:59:41 -05:00
create table(:properties, primary_key: false) do
add(:id, :binary_id, primary_key: true)
2021-02-24 07:49:39 -05:00
add(:name, :string)
add(:price, :decimal)
add(:description, :text)
add(:user_id, references(:users, type: :binary_id, on_delete: :delete_all), null: false)
2020-09-14 12:22:25 -04:00
timestamps()
end
2021-02-24 07:49:39 -05:00
create(index(:properties, [:user_id]))
2020-09-14 12:22:25 -04:00
end
end