crystal-gauntlet/db/migrations/16_friends.sql

28 lines
706 B
MySQL
Raw Normal View History

2023-01-06 07:46:21 +01:00
-- +migrate up
-- todo: maybe merge this and messages into one?
CREATE TABLE friend_requests (
id SERIAL PRIMARY KEY,
from_account_id INTEGER NOT NULL references accounts(id),
to_account_id INTEGER NOT NULL references accounts(id),
body VARCHAR(140) NOT NULL,
created_at TEXT NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'now')),
read_at TEXT
);
CREATE TABLE friend_links (
account_id_1 INTEGER references accounts(id),
account_id_2 INTEGER references accounts(id),
2023-01-06 08:39:40 +01:00
read_at_1 TEXT,
read_at_2 TEXT,
2023-01-06 07:46:21 +01:00
created_at TEXT NOT NULL DEFAULT (STRFTIME('%Y-%m-%d %H:%M:%f', 'now'))
);
-- +migrate down
2023-01-06 15:25:33 +01:00
DROP TABLE friend_requests;
DROP TABLE friend_links;