20 lines
No EOL
832 B
SQL
20 lines
No EOL
832 B
SQL
CREATE TABLE `user_sessions` (
|
|
`token` text PRIMARY KEY NOT NULL,
|
|
`user_id` text NOT NULL,
|
|
`max_age` integer NOT NULL,
|
|
`created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
`updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `user_sessions_token_unique` ON `user_sessions` (`token`);--> statement-breakpoint
|
|
CREATE TABLE `users` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`email` text NOT NULL,
|
|
`name` text NOT NULL,
|
|
`hash` text NOT NULL,
|
|
`created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
|
|
`updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE UNIQUE INDEX `users_email_unique` ON `users` (`email`); |