mirror of https://gitlab.com/litecord/litecord.git
0_base.sql: fix ordering of table creations
fixes attachments table being created BEFORE its foreign keys
This commit is contained in:
parent
bb542550b8
commit
6ba9b07381
|
|
@ -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
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue