SimpleCloudNotifier/web/api/schema.sql

37 lines
1.3 KiB
MySQL
Raw Permalink Normal View History

2018-11-12 14:10:35 +01:00
DROP TABLE IF EXISTS `users`;
2018-09-22 01:35:41 +02:00
CREATE TABLE `users`
(
2018-11-12 13:03:01 +01:00
`user_id` INT(11) NOT NULL AUTO_INCREMENT,
`user_key` VARCHAR(64) NOT NULL,
`fcm_token` VARCHAR(256) NULL DEFAULT NULL,
`messages_sent` INT(11) NOT NULL DEFAULT '0',
`timestamp_created` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`timestamp_accessed` DATETIME NULL DEFAULT NULL,
2018-09-22 19:57:00 +02:00
2018-11-12 13:03:01 +01:00
`quota_today` INT(11) NOT NULL DEFAULT '0',
`quota_day` DATE NULL DEFAULT NULL,
2018-11-12 00:15:50 +01:00
2018-11-12 13:03:01 +01:00
`is_pro` BIT NOT NULL DEFAULT 0,
`pro_token` VARCHAR(256) NULL DEFAULT NULL,
2018-09-22 19:57:00 +02:00
2018-09-26 23:13:50 +02:00
PRIMARY KEY (`user_id`)
2018-09-22 01:35:41 +02:00
);
2018-11-12 13:03:01 +01:00
2018-11-12 14:10:35 +01:00
DROP TABLE IF EXISTS `messages`;
2018-11-12 13:03:01 +01:00
CREATE TABLE `messages`
(
`scn_message_id` INT(11) NOT NULL AUTO_INCREMENT,
`sender_user_id` INT(11) NOT NULL,
`timestamp` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
2018-11-12 15:51:06 +01:00
`ack` BIT NOT NULL DEFAULT 0,
2018-11-12 13:03:01 +01:00
`title` VARCHAR(256) NOT NULL,
`content` VARCHAR(12288) NULL,
`priority` INT(11) NOT NULL,
2018-11-12 15:51:06 +01:00
`fcm_message_id` VARCHAR(256) NULL,
2018-11-12 13:03:01 +01:00
`usr_message_id` VARCHAR(256) NULL,
PRIMARY KEY (`scn_message_id`)
2018-11-12 14:10:35 +01:00
);