From 2d514aac31974ce21212ff93db8fdbbf8349a1d8 Mon Sep 17 00:00:00 2001 From: Eli Ribble Date: Thu, 18 Dec 2025 03:35:55 -0700 Subject: [PATCH] Fix up new nidus note migration Had some copy-paste errors, a simple typo that got replicated, and an incomplete foreign key reference --- db/migrations/00018_nidus_notes.sql | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/db/migrations/00018_nidus_notes.sql b/db/migrations/00018_nidus_notes.sql index 736f8987..4183e439 100644 --- a/db/migrations/00018_nidus_notes.sql +++ b/db/migrations/00018_nidus_notes.sql @@ -34,7 +34,7 @@ CREATE TYPE AudioDataType AS ENUM ( CREATE TABLE note_audio_data ( created TIMESTAMP WITHOUT TIME ZONE NOT NULL, note_audio_version INTEGER NOT NULL, - node_audio_uuid UUID NOT NULL, + note_audio_uuid UUID NOT NULL, type_ AudioDataType NOT NULL, FOREIGN KEY (note_audio_version, note_audio_uuid) REFERENCES note_audio (version, uuid), @@ -55,14 +55,16 @@ CREATE TABLE note_image ( CREATE TYPE ImageDataType AS ENUM ( 'raw', - 'png', -); + 'png'); CREATE TABLE note_image_data ( created TIMESTAMP WITHOUT TIME ZONE NOT NULL, note_image_version INTEGER NOT NULL, - node_image_uuid UUID NOT NULL, + note_image_uuid UUID NOT NULL, type_ AudioDataType NOT NULL, + + FOREIGN KEY (note_image_version, note_image_uuid) REFERENCES note_image (version, uuid), + PRIMARY KEY (note_image_version, note_image_uuid, type_) ); @@ -71,7 +73,7 @@ CREATE TABLE note_image_breadcrumb ( created TIMESTAMP WITHOUT TIME ZONE NOT NULL, manually_selected BOOLEAN NOT NULL, note_image_version INTEGER NOT NULL, - node_image_uuid UUID NOT NULL, + note_image_uuid UUID NOT NULL, position INTEGER NOT NULL, FOREIGN KEY (note_image_version, note_image_uuid) REFERENCES note_image (version, uuid),