migration.scripts: add 10_add_attachments_table

- schema.sql: add attachments table
This commit is contained in:
Luna 2018-12-08 22:08:37 -03:00
parent ed7b873e0d
commit d5ad4bb96d
2 changed files with 36 additions and 0 deletions

View File

@ -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)
);

View File

@ -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,