PRIMARY KEY moved out on a separate line. Use INTEGER (Unix time) for created dates to save space.
This commit is contained in:
parent
c658b798aa
commit
613f0c1616
@ -1,19 +1,21 @@
|
|||||||
-- SQLite3
|
-- SQLite3
|
||||||
CREATE TABLE IF NOT EXISTS `entry` (
|
CREATE TABLE IF NOT EXISTS `entry` (
|
||||||
`entry_id` INTEGER PRIMARY KEY NOT NULL,
|
`entry_id` INTEGER NOT NULL,
|
||||||
`created` TEXT NOT NULL,
|
`created` INTEGER NOT NULL,
|
||||||
`name` TEXT NOT NULL,
|
`name` TEXT NOT NULL,
|
||||||
`message` TEXT NOT NULL,
|
`message` TEXT NOT NULL,
|
||||||
`website` TEXT NOT NULL,
|
`website` TEXT NOT NULL,
|
||||||
`hide_website` INTEGER NOT NULL DEFAULT TRUE);
|
`hide_website` INTEGER NOT NULL DEFAULT TRUE,
|
||||||
|
PRIMARY KEY (`entry_id`) );
|
||||||
|
|
||||||
CREATE INDEX IF NOT EXISTS `entry_created_idx`
|
CREATE INDEX IF NOT EXISTS `entry_created_idx`
|
||||||
ON `entry` (`created`);
|
ON `entry` (`created`);
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `reply` (
|
CREATE TABLE IF NOT EXISTS `reply` (
|
||||||
`entry_id` INTEGER PRIMARY KEY NOT NULL,
|
`entry_id` INTEGER NOT NULL,
|
||||||
`created` TEXT NOT NULL,
|
`created` INTEGER NOT NULL,
|
||||||
`message` TEXT NOT NULL,
|
`message` TEXT NOT NULL,
|
||||||
|
PRIMARY KEY (`entry_id`),
|
||||||
FOREIGN KEY (`entry_id`)
|
FOREIGN KEY (`entry_id`)
|
||||||
REFERENCES `entry` (`entry_id`)
|
REFERENCES `entry` (`entry_id`)
|
||||||
ON DELETE CASCADE
|
ON DELETE CASCADE
|
||||||
|
Loading…
Reference in New Issue
Block a user