First pass at record sets

This commit is contained in:
Claudio Ortolina
2026-02-05 11:46:52 +00:00
parent b17fa006d5
commit 419b093101
13 changed files with 1089 additions and 0 deletions
@@ -0,0 +1,13 @@
defmodule MusicLibrary.Repo.Migrations.CreateRecordSets do
use Ecto.Migration
def change do
create table(:record_sets, primary_key: false) do
add :id, :binary_id, primary_key: true
add :name, :string, null: false
add :description, :text
timestamps(type: :utc_datetime)
end
end
end
@@ -0,0 +1,21 @@
defmodule MusicLibrary.Repo.Migrations.CreateRecordSetItems do
use Ecto.Migration
def change do
create table(:record_set_items, primary_key: false) do
add :id, :binary_id, primary_key: true
add :position, :integer, null: false
add :record_set_id, references(:record_sets, type: :binary_id, on_delete: :delete_all),
null: false
add :record_id, references(:records, type: :binary_id, on_delete: :delete_all), null: false
timestamps(type: :utc_datetime)
end
create index(:record_set_items, [:record_set_id])
create unique_index(:record_set_items, [:record_set_id, :record_id])
create index(:record_set_items, [:record_set_id, :position])
end
end