mirror of https://gitlab.com/litecord/litecord.git
migration.scripts: add 10_add_attachments_table
- schema.sql: add attachments table
This commit is contained in:
parent
ed7b873e0d
commit
d5ad4bb96d
|
|
@ -0,0 +1,21 @@
|
||||||
|
CREATE TABLE IF NOT EXISTS attachments (
|
||||||
|
id bigint PRIMARY KEY,
|
||||||
|
|
||||||
|
filename text NOT NULL,
|
||||||
|
filesize integer,
|
||||||
|
|
||||||
|
image boolean DEFAULT FALSE,
|
||||||
|
|
||||||
|
-- only not null if image=true
|
||||||
|
height 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)
|
||||||
|
);
|
||||||
|
|
||||||
15
schema.sql
15
schema.sql
|
|
@ -52,6 +52,21 @@ CREATE TABLE IF NOT EXISTS instance_invites (
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
-- main attachments table
|
||||||
|
CREATE TABLE IF NOT EXISTS attachments (
|
||||||
|
id bigint PRIMARY KEY,
|
||||||
|
|
||||||
|
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 (
|
CREATE TABLE IF NOT EXISTS icons (
|
||||||
-- can be 'user', 'guild', 'emoji'
|
-- can be 'user', 'guild', 'emoji'
|
||||||
scope text NOT NULL,
|
scope text NOT NULL,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue