freechat/json-api/migrations/2020-07-06-022319_messages/up.sql
shockrah a1f86fdf6e * Moving away from auto_increment
! Initial id size will stay as u64 but u128 are easily the next major change
This change shouldn't break clients written in high level languages since most already use 128's under the hood anyway
- This commit also removes the auto_increment flag from basically everything that uses RNG id's
2021-03-24 01:14:37 -07:00

14 lines
521 B
SQL

-- Time stamp is _not_ in ms
CREATE TABLE IF NOT EXISTS `messages`(
`id` BIGINT UNSIGNED NOT NULL,
`time` BIGINT NOT NULL,
-- Assuming content-type is `not` text/plain this will be a reference to some auto-named file
`content` VARCHAR(4096) NOT NULL,
`content_type` VARCHAR(10) NOT NULL,
`author_id` BIGINT UNSIGNED NOT NULL,
`channel_id` BIGINT UNSIGNED NOT NULL,
PRIMARY KEY (`id`),
FOREIGN KEY (`author_id`) REFERENCES members(`id`),
FOREIGN KEY (`channel_id`) REFERENCES channels(`id`) ON DELETE CASCADE
);