mirror of https://gitlab.com/litecord/litecord.git
migration.scripts: add attachments.{channel, message}_id
- schema.sql: remove message_attachments table
it is uneeded since we have the columns in attachments
This commit is contained in:
parent
9ecc3d9e7e
commit
e885bf859c
|
|
@ -1,6 +1,9 @@
|
||||||
CREATE TABLE IF NOT EXISTS attachments (
|
CREATE TABLE IF NOT EXISTS attachments (
|
||||||
id bigint PRIMARY KEY,
|
id bigint PRIMARY KEY,
|
||||||
|
|
||||||
|
channel_id bigint REFERENCES channels (id),
|
||||||
|
message_id bigint REFERENCES messages (id),
|
||||||
|
|
||||||
filename text NOT NULL,
|
filename text NOT NULL,
|
||||||
filesize integer,
|
filesize integer,
|
||||||
|
|
||||||
|
|
@ -10,12 +13,3 @@ CREATE TABLE IF NOT EXISTS attachments (
|
||||||
height integer DEFAULT NULL,
|
height integer DEFAULT NULL,
|
||||||
width integer DEFAULT NULL
|
width integer DEFAULT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
-- recreate the attachments table since
|
|
||||||
-- its been always error'ing since some migrations ago.
|
|
||||||
CREATE TABLE IF NOT EXISTS message_attachments (
|
|
||||||
message_id bigint REFERENCES messages (id),
|
|
||||||
attachment bigint REFERENCES attachments (id),
|
|
||||||
PRIMARY KEY (message_id, attachment)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
|
||||||
11
schema.sql
11
schema.sql
|
|
@ -56,6 +56,11 @@ CREATE TABLE IF NOT EXISTS instance_invites (
|
||||||
CREATE TABLE IF NOT EXISTS attachments (
|
CREATE TABLE IF NOT EXISTS attachments (
|
||||||
id bigint PRIMARY KEY,
|
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,
|
filename text NOT NULL,
|
||||||
filesize integer,
|
filesize integer,
|
||||||
|
|
||||||
|
|
@ -634,12 +639,6 @@ CREATE TABLE IF NOT EXISTS messages (
|
||||||
message_type int NOT NULL
|
message_type int NOT NULL
|
||||||
);
|
);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS message_attachments (
|
|
||||||
message_id bigint REFERENCES messages (id),
|
|
||||||
attachment bigint REFERENCES attachments (id),
|
|
||||||
PRIMARY KEY (message_id, attachment)
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS message_reactions (
|
CREATE TABLE IF NOT EXISTS message_reactions (
|
||||||
message_id bigint REFERENCES messages (id),
|
message_id bigint REFERENCES messages (id),
|
||||||
user_id bigint REFERENCES users (id),
|
user_id bigint REFERENCES users (id),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue