Foundation: single arm64 container (Hono + SQLite via Drizzle, React + Vite), local sign-in with long-lived sessions and passkeys, roles (read-only, full access, admin), nightly and pre-upgrade backups, light and dark themes, date-based version numbers, and the ideas lightbulb behind IDEAS_ENABLED. Money in: accounts with balances, CSV import with bank detection, a column mapping pop-up for unknown layouts, duplicate checks, transfer pairing and undo; one-tap review with learned rules; activity with search, splits, tags, notes and cash entries. Statement files are blocked from commits by a pre-commit hook; tests use synthetic fixtures only. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
2.5 KiB
SQL
77 lines
2.5 KiB
SQL
CREATE TABLE `change_log` (
|
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
`at` text NOT NULL,
|
|
`user_id` integer,
|
|
`action` text NOT NULL,
|
|
`entity` text NOT NULL,
|
|
`entity_id` text,
|
|
`detail` text,
|
|
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `change_log_at_idx` ON `change_log` (`at`);--> statement-breakpoint
|
|
CREATE TABLE `idea` (
|
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
`title` text NOT NULL,
|
|
`description` text DEFAULT '' NOT NULL,
|
|
`status` text DEFAULT 'new' NOT NULL,
|
|
`admin_note` text,
|
|
`path` text,
|
|
`app_version` text,
|
|
`user_agent` text,
|
|
`user_id` integer,
|
|
`created_at` text NOT NULL,
|
|
`updated_at` text NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `idea_status_idx` ON `idea` (`status`);--> statement-breakpoint
|
|
CREATE TABLE `passkey` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`user_id` integer NOT NULL,
|
|
`name` text NOT NULL,
|
|
`public_key` blob NOT NULL,
|
|
`counter` integer DEFAULT 0 NOT NULL,
|
|
`transports` text,
|
|
`device_type` text,
|
|
`backed_up` integer DEFAULT false NOT NULL,
|
|
`created_at` text NOT NULL,
|
|
`last_used_at` text,
|
|
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `passkey_user_idx` ON `passkey` (`user_id`);--> statement-breakpoint
|
|
CREATE TABLE `session` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`user_id` integer NOT NULL,
|
|
`kind` text DEFAULT 'browser' NOT NULL,
|
|
`device_label` text NOT NULL,
|
|
`user_agent` text,
|
|
`ip` text,
|
|
`created_at` text NOT NULL,
|
|
`last_seen_at` text NOT NULL,
|
|
`expires_at` text NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `session_user_idx` ON `session` (`user_id`);--> statement-breakpoint
|
|
CREATE TABLE `setting` (
|
|
`key` text PRIMARY KEY NOT NULL,
|
|
`value` text NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `user` (
|
|
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
`username` text NOT NULL,
|
|
`display_name` text NOT NULL,
|
|
`password_hash` text NOT NULL,
|
|
`access` text DEFAULT 'full' NOT NULL,
|
|
`is_admin` integer DEFAULT false NOT NULL,
|
|
`theme` text DEFAULT 'system' NOT NULL,
|
|
`must_change_password` integer DEFAULT false NOT NULL,
|
|
`created_at` text NOT NULL,
|
|
`updated_at` text NOT NULL,
|
|
`deleted_at` text
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`); |