Use composite primary key on asset_attachments
Drop the surrogate id in favour of a composite primary key on
(asset_id, file_id), which both removes the unnecessary column and
enforces uniqueness at the schema level.
change
commit 48024cffa89ff742fb6ea5372c3af35efdfec08a
author Claude <noreply@anthropic.com>
date
parent ec7b7281
diff --git a/db/migrate/004_create_asset_attachments.rb b/db/migrate/004_create_asset_attachments.rb
index a9914cf..432abea 100644
--- a/db/migrate/004_create_asset_attachments.rb
+++ b/db/migrate/004_create_asset_attachments.rb
@@ -3,10 +3,10 @@
 Sequel.migration do
   change do
     create_table(:asset_attachments) do
-      primary_key :id
       foreign_key :asset_id, :assets, null: false
       foreign_key :file_id, :files, null: false
       DateTime :created_at, null: false
+      primary_key [:asset_id, :file_id]
     end
   end
 end