CREATE TABLE `contacts` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` text NOT NULL, `role` text DEFAULT '' NOT NULL, `location` text DEFAULT '' NOT NULL, `email` text DEFAULT '' NOT NULL, `phone` text DEFAULT '' NOT NULL, `photo_id` integer, `listed` integer DEFAULT true NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL, FOREIGN KEY (`photo_id`) REFERENCES `media`(`id`) ON UPDATE no action ON DELETE set null ); --> statement-breakpoint CREATE TABLE `events` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `title` text NOT NULL, `kind` text DEFAULT 'event' NOT NULL, `start_date` text NOT NULL, `end_date` text DEFAULT '' NOT NULL, `start_time` text DEFAULT '' NOT NULL, `end_time` text DEFAULT '' NOT NULL, `location` text DEFAULT '' NOT NULL, `description` text DEFAULT '' NOT NULL, `published` integer DEFAULT true NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL ); --> statement-breakpoint CREATE INDEX `events_start_idx` ON `events` (`start_date`);--> statement-breakpoint CREATE TABLE `media` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `filename` text NOT NULL, `thumbnail` text, `original_name` text NOT NULL, `mime_type` text NOT NULL, `size` integer NOT NULL, `width` integer, `height` integer, `alt` text DEFAULT '' NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL ); --> statement-breakpoint CREATE UNIQUE INDEX `media_filename_unique` ON `media` (`filename`);--> statement-breakpoint CREATE TABLE `messages` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` text NOT NULL, `email` text NOT NULL, `message` text NOT NULL, `read` integer DEFAULT false NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL ); --> statement-breakpoint CREATE TABLE `pages` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `parent_id` integer, `title` text NOT NULL, `slug` text NOT NULL, `teaser` text DEFAULT '' NOT NULL, `icon` text DEFAULT 'file-text' NOT NULL, `color` text DEFAULT 'sky' NOT NULL, `cover_id` integer, `content` text DEFAULT '' NOT NULL, `content_easy` text DEFAULT '' NOT NULL, `attachments` text DEFAULT '[]' NOT NULL, `contact_ids` text DEFAULT '[]' NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `published` integer DEFAULT true NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL, FOREIGN KEY (`parent_id`) REFERENCES `pages`(`id`) ON UPDATE no action ON DELETE set null, FOREIGN KEY (`cover_id`) REFERENCES `media`(`id`) ON UPDATE no action ON DELETE set null ); --> statement-breakpoint CREATE UNIQUE INDEX `pages_slug_idx` ON `pages` (`slug`);--> statement-breakpoint CREATE INDEX `pages_parent_idx` ON `pages` (`parent_id`);--> statement-breakpoint CREATE TABLE `posts` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `title` text NOT NULL, `slug` text NOT NULL, `teaser` text DEFAULT '' NOT NULL, `cover_id` integer, `content` text DEFAULT '' NOT NULL, `content_easy` text DEFAULT '' NOT NULL, `video_url` text DEFAULT '' NOT NULL, `gallery` text DEFAULT '[]' NOT NULL, `attachments` text DEFAULT '[]' NOT NULL, `contact_ids` text DEFAULT '[]' NOT NULL, `pinned` integer DEFAULT false NOT NULL, `published` integer DEFAULT true NOT NULL, `published_at` integer DEFAULT (unixepoch()) NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL, FOREIGN KEY (`cover_id`) REFERENCES `media`(`id`) ON UPDATE no action ON DELETE set null ); --> statement-breakpoint CREATE UNIQUE INDEX `posts_slug_idx` ON `posts` (`slug`);--> statement-breakpoint CREATE INDEX `posts_published_idx` ON `posts` (`published_at`);--> statement-breakpoint CREATE TABLE `sessions` ( `id` text PRIMARY KEY NOT NULL, `user_id` integer NOT NULL, `expires_at` integer NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE TABLE `settings` ( `key` text PRIMARY KEY NOT NULL, `value` text NOT NULL ); --> statement-breakpoint CREATE TABLE `tiles` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `label` text NOT NULL, `icon` text DEFAULT 'star' NOT NULL, `color` text DEFAULT 'sky' NOT NULL, `href` text NOT NULL, `sort_order` integer DEFAULT 0 NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL ); --> statement-breakpoint CREATE TABLE `users` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `email` text NOT NULL, `name` text NOT NULL, `password_hash` text NOT NULL, `role` text DEFAULT 'editor' NOT NULL, `created_at` integer DEFAULT (unixepoch()) NOT NULL, `updated_at` integer DEFAULT (unixepoch()) NOT NULL ); --> statement-breakpoint CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`);