1
0
justguestbook/sqlite_queries/schema.sql

22 lines
643 B
SQL

-- SQLite3
CREATE TABLE IF NOT EXISTS `entry` (
`entry_id` INTEGER NOT NULL,
`created` INTEGER NOT NULL,
`name` TEXT NOT NULL,
`message` TEXT NOT NULL,
`website` TEXT NOT NULL,
`hide_website` INTEGER NOT NULL DEFAULT TRUE,
PRIMARY KEY (`entry_id`) );
CREATE INDEX IF NOT EXISTS `entry_created_idx`
ON `entry` (`created`);
CREATE TABLE IF NOT EXISTS `reply` (
`entry_id` INTEGER NOT NULL,
`created` INTEGER NOT NULL,
`message` TEXT NOT NULL,
PRIMARY KEY (`entry_id`),
FOREIGN KEY (`entry_id`)
REFERENCES `entry` (`entry_id`)
ON DELETE CASCADE
ON UPDATE CASCADE );