After 'mix phx.gen.live Items Item items name:string description:string info:string amount:integer factor:float type:string'
This commit is contained in:
20
priv/repo/migrations/20260421112128_create_items.exs
Normal file
20
priv/repo/migrations/20260421112128_create_items.exs
Normal file
@ -0,0 +1,20 @@
|
||||
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
|
||||
Reference in New Issue
Block a user