You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.6 KiB
39 lines
1.6 KiB
CREATE TABLE `sessions` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`user_id` integer NOT NULL,
|
|
`expires_at` integer NOT NULL,
|
|
`created_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `sessions_user_id_idx` ON `sessions` (`user_id`);--> statement-breakpoint
|
|
CREATE TABLE `users` (
|
|
`id` integer PRIMARY KEY NOT NULL,
|
|
`username` text NOT NULL,
|
|
`email` text,
|
|
`nickname` text,
|
|
`password` text NOT NULL,
|
|
`avatar` text,
|
|
`created_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
|
|
`updated_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `users_username_unique` ON `users` (`username`);--> statement-breakpoint
|
|
CREATE TABLE `app_configs` (
|
|
`key` text PRIMARY KEY NOT NULL,
|
|
`value` text NOT NULL,
|
|
`value_type` text NOT NULL,
|
|
`updated_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `user_configs` (
|
|
`user_id` integer NOT NULL,
|
|
`key` text NOT NULL,
|
|
`value` text NOT NULL,
|
|
`value_type` text NOT NULL,
|
|
`updated_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
|
|
PRIMARY KEY(`user_id`, `key`),
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `user_configs_user_id_idx` ON `user_configs` (`user_id`);
|