1
0
dwelling-home/pkg/mindflow/database/sqlite/queries/schema.sql

24 lines
679 B
MySQL
Raw Normal View History

-- SQLite3
CREATE TABLE IF NOT EXISTS `category` (
`category_id` INTEGER NOT NULL,
`name` TEXT NOT NULL,
PRIMARY KEY (`category_id`),
2023-05-19 21:53:44 +04:00
UNIQUE (`name`) );
INSERT OR IGNORE INTO `category`
VALUES
(1, 'Update'),
(2, 'Diary');
CREATE TABLE IF NOT EXISTS `post` (
`post_id` INTEGER NOT NULL,
`category_id` INTEGER NOT NULL,
`date` INTEGER NOT NULL,
`title` TEXT NOT NULL,
`url` TEXT NOT NULL DEFAULT "",
`body` TEXT NOT NULL,
PRIMARY KEY (`post_id`),
FOREIGN KEY (`category_id`)
REFERENCES `category` (`category_id`)
ON DELETE CASCADE
2023-05-19 21:53:44 +04:00
ON UPDATE CASCADE );