diff --git a/manage/cmd/migration/scripts/0_base.sql b/manage/cmd/migration/scripts/0_base.sql index 1a60a9e..cd057bd 100644 --- a/manage/cmd/migration/scripts/0_base.sql +++ b/manage/cmd/migration/scripts/0_base.sql @@ -42,24 +42,6 @@ CREATE TABLE IF NOT EXISTS instance_invites ( ); --- main attachments table -CREATE TABLE IF NOT EXISTS attachments ( - id bigint PRIMARY KEY, - - -- keeping channel_id and message_id - -- make a way "better" attachment url. - channel_id bigint REFERENCES channels (id), - message_id bigint REFERENCES messages (id), - - filename text NOT NULL, - filesize integer, - - image boolean DEFAULT FALSE, - - -- only not null if image=true - height integer DEFAULT NULL, - width integer DEFAULT NULL -); CREATE TABLE IF NOT EXISTS icons ( @@ -693,3 +675,23 @@ CREATE TABLE IF NOT EXISTS channel_pins ( message_id bigint REFERENCES messages (id) ON DELETE CASCADE, PRIMARY KEY (channel_id, message_id) ); + + +-- main attachments table +CREATE TABLE IF NOT EXISTS attachments ( + id bigint PRIMARY KEY, + + -- keeping channel_id and message_id + -- make a way "better" attachment url. + channel_id bigint REFERENCES channels (id), + message_id bigint REFERENCES messages (id), + + filename text NOT NULL, + filesize integer, + + image boolean DEFAULT FALSE, + + -- only not null if image=true + height integer DEFAULT NULL, + width integer DEFAULT NULL +);