You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
83 lines
2.3 KiB
SQL
83 lines
2.3 KiB
SQL
CREATE TABLE `accounts` (
|
|
`user_id` text,
|
|
`provider` text NOT NULL,
|
|
`username` text NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `appunti` (
|
|
`user_id` text,
|
|
`hash` text NOT NULL,
|
|
`link` text,
|
|
`visibility` text NOT NULL,
|
|
`title` text NOT NULL,
|
|
`description` text,
|
|
`tags` text NOT NULL,
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `poisson_requests` (
|
|
`user_id` text,
|
|
`request_type` text NOT NULL,
|
|
`comments` text,
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE no action
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `users` (
|
|
`id` text,
|
|
`username` text NOT NULL,
|
|
`full_name` text,
|
|
`email` text,
|
|
FOREIGN KEY (`id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE no action
|
|
);
|
|
--> statement-breakpoint
|
|
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 `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 `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,
|
|
`updated_at` integer
|
|
);
|