From 7c94fa0587ca14f0940bce3fb356aaffcf954d7b Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sun, 12 Nov 2023 20:06:11 -0800 Subject: [PATCH] Add id to join table --- db/migrations/002_pinboard_archive.rb | 3 +++ db/migrations/003_create_tags.rb | 1 + 2 files changed, 4 insertions(+) diff --git a/db/migrations/002_pinboard_archive.rb b/db/migrations/002_pinboard_archive.rb index 7b8c0fd..f0a530f 100644 --- a/db/migrations/002_pinboard_archive.rb +++ b/db/migrations/002_pinboard_archive.rb @@ -19,5 +19,8 @@ Sequel.migration do entity_id = DB[:entities].insert(created_at:, modified_at:) DB[:pinboard].insert(entity_id:, json: , created_at:, modified_at:) end + + # Remove duplicate entry + DB[:pinboard].where(id: 5001).delete end end diff --git a/db/migrations/003_create_tags.rb b/db/migrations/003_create_tags.rb index db3f7c5..9339850 100644 --- a/db/migrations/003_create_tags.rb +++ b/db/migrations/003_create_tags.rb @@ -10,6 +10,7 @@ Sequel.migration do end create_table(:entities_tags) do + primary_key :id foreign_key :entity_id, :entities, null: false foreign_key :tag_id, :tags, null: false