21 lines
527 B
Elixir
21 lines
527 B
Elixir
defmodule GenericRestServer.Repo.Migrations.CreateItems do
|
|
use Ecto.Migration
|
|
|
|
def change do
|
|
create table(:items, primary_key: false) do
|
|
add :id, :binary_id, primary_key: true
|
|
add :name, :string
|
|
add :description, :string
|
|
add :info, :string
|
|
add :amount, :integer
|
|
add :factor, :float
|
|
add :type, :string
|
|
add :user_id, references(:users, type: :binary_id, on_delete: :delete_all)
|
|
|
|
timestamps(type: :utc_datetime)
|
|
end
|
|
|
|
create index(:items, [:user_id])
|
|
end
|
|
end
|