feat: initialize SQLite with versioned migrations and sample content

This commit is contained in:
2026-09-15 21:47:42 +03:30
parent 8bfe35f6b9
commit a9fe865d99
10 changed files with 765 additions and 0 deletions

View File

@@ -0,0 +1,88 @@
CREATE TABLE `account` (
`id` text PRIMARY KEY NOT NULL,
`account_id` text NOT NULL,
`provider_id` text NOT NULL,
`user_id` text NOT NULL,
`access_token` text,
`refresh_token` text,
`id_token` text,
`access_token_expires_at` integer,
`refresh_token_expires_at` integer,
`scope` text,
`password` text,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `entries` (
`id` text PRIMARY KEY NOT NULL,
`kind` text NOT NULL,
`position` integer NOT NULL,
`visible` integer NOT NULL,
`shared` text NOT NULL,
`translations` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `languages` (
`code` text PRIMARY KEY NOT NULL,
`data` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `media` (
`key` text PRIMARY KEY NOT NULL,
`original_name` text NOT NULL,
`mime` text NOT NULL,
`width` integer,
`height` integer,
`size` integer NOT NULL,
`created_at` integer NOT NULL
);
--> statement-breakpoint
CREATE TABLE `sections` (
`key` text PRIMARY KEY NOT NULL,
`data` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `session` (
`id` text PRIMARY KEY NOT NULL,
`expires_at` integer NOT NULL,
`token` text NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL,
`ip_address` text,
`user_agent` text,
`user_id` text NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE UNIQUE INDEX `session_token_unique` ON `session` (`token`);--> statement-breakpoint
CREATE TABLE `site_settings` (
`id` integer PRIMARY KEY NOT NULL,
`data` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `app_state` (
`key` text PRIMARY KEY NOT NULL,
`value` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `user` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`email` text NOT NULL,
`email_verified` integer NOT NULL,
`image` text,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);
--> statement-breakpoint
CREATE UNIQUE INDEX `user_email_unique` ON `user` (`email`);--> statement-breakpoint
CREATE TABLE `verification` (
`id` text PRIMARY KEY NOT NULL,
`identifier` text NOT NULL,
`value` text NOT NULL,
`expires_at` integer NOT NULL,
`created_at` integer NOT NULL,
`updated_at` integer NOT NULL
);