add models, context and liveviews
This commit is contained in:
17
priv/repo/migrations/20210903015442_create_tags.exs
Normal file
17
priv/repo/migrations/20210903015442_create_tags.exs
Normal file
@ -0,0 +1,17 @@
|
||||
defmodule Cannery.Repo.Migrations.CreateTags do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:tags, primary_key: false) do
|
||||
add :id, :binary_id, primary_key: true
|
||||
add :name, :string
|
||||
add :"bg-color", :string
|
||||
add :"text-color", :string
|
||||
add :user_id, references(:users, on_delete: :nothing, type: :binary_id)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:tags, [:user_id])
|
||||
end
|
||||
end
|
18
priv/repo/migrations/20210903015537_create_ammo_types.exs
Normal file
18
priv/repo/migrations/20210903015537_create_ammo_types.exs
Normal file
@ -0,0 +1,18 @@
|
||||
defmodule Cannery.Repo.Migrations.CreateAmmoTypes do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:ammo_types, primary_key: false) do
|
||||
add :id, :binary_id, primary_key: true
|
||||
add :name, :string
|
||||
add :desc, :string
|
||||
add :case_material, :string
|
||||
add :bullet_type, :string
|
||||
add :weight, :float
|
||||
add :manufacturer, :string
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
end
|
||||
end
|
18
priv/repo/migrations/20210903015553_create_containers.exs
Normal file
18
priv/repo/migrations/20210903015553_create_containers.exs
Normal file
@ -0,0 +1,18 @@
|
||||
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
|
||||
add :desc, :string
|
||||
add :type, :string
|
||||
add :location, :string
|
||||
add :user_id, references(:users, on_delete: :nothing, type: :binary_id)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:containers, [:user_id])
|
||||
end
|
||||
end
|
23
priv/repo/migrations/20210903015611_create_ammo_groups.exs
Normal file
23
priv/repo/migrations/20210903015611_create_ammo_groups.exs
Normal file
@ -0,0 +1,23 @@
|
||||
defmodule Cannery.Repo.Migrations.CreateAmmoGroups do
|
||||
use Ecto.Migration
|
||||
|
||||
def change do
|
||||
create table(:ammo_groups, primary_key: false) do
|
||||
add :id, :binary_id, primary_key: true
|
||||
add :count, :integer
|
||||
add :price_paid, :float
|
||||
add :notes, :text
|
||||
add :tag_id, references(:tags, on_delete: :nothing, type: :binary_id)
|
||||
add :ammo_type_id, references(:ammo_types, on_delete: :nothing, type: :binary_id)
|
||||
add :container_id, references(:containers, on_delete: :nothing, type: :binary_id)
|
||||
add :user_id, references(:users, on_delete: :nothing, type: :binary_id)
|
||||
|
||||
timestamps()
|
||||
end
|
||||
|
||||
create index(:ammo_groups, [:tag_id])
|
||||
create index(:ammo_groups, [:ammo_type_id])
|
||||
create index(:ammo_groups, [:container_id])
|
||||
create index(:ammo_groups, [:user_id])
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user