From 04d3000a790e00e8034b2640f8cacdd9e05019a8 Mon Sep 17 00:00:00 2001 From: Alpha Chen Date: Sun, 12 Nov 2023 19:01:35 -0800 Subject: [PATCH] sources and notes --- db/migrations/006_create_sources_and_notes.rb | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 db/migrations/006_create_sources_and_notes.rb diff --git a/db/migrations/006_create_sources_and_notes.rb b/db/migrations/006_create_sources_and_notes.rb new file mode 100644 index 0000000..25181e3 --- /dev/null +++ b/db/migrations/006_create_sources_and_notes.rb @@ -0,0 +1,22 @@ +Sequel.migration do + change do + create_table(:sources) do + foreign_key :entity_id, :entities + foreign_key :source_id, :entities + + DateTime :created_at, null: false + DateTime :modified_at, null: false + + unique %i[entity_id source_id] + end + + create_table(:notes) do + foreign_key :entity_id, :entities + + String :text, text: true + + DateTime :created_at, null: false + DateTime :modified_at, null: false + end + end +end