Files
Homarr/drizzle/0000_supreme_the_captain.sql
Meier Lukas 1d50e2ce9a ♻️ Migrate from prisma to drizzle (#1434)
* ♻️ Migrate from prisma to drizzle
* 🐛 Build issue with CalendarTile
* 🚧 Temporary solution for docker container
* 🐛 Drizzle not using DATABASE_URL
* ♻️ Address pull request feedback
* 🐛 Remove console log of env variables
* 🐛 Some unit tests not working
* 🐋 Revert docker tool changes
* 🐛 Issue with board slug page for logged in users

---------

Co-authored-by: Thomas Camlong <thomascamlong@gmail.com>
2023-10-08 12:10:48 +02:00

69 lines
2.3 KiB
SQL

CREATE TABLE `account` (
`userId` text NOT NULL,
`type` text NOT NULL,
`provider` text NOT NULL,
`providerAccountId` text NOT NULL,
`refresh_token` text,
`access_token` text,
`expires_at` integer,
`token_type` text,
`scope` text,
`id_token` text,
`session_state` text,
PRIMARY KEY(`provider`, `providerAccountId`),
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `invite` (
`id` text PRIMARY KEY NOT NULL,
`token` text NOT NULL,
`expires` integer NOT NULL,
`created_by_id` text NOT NULL,
FOREIGN KEY (`created_by_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `session` (
`sessionToken` text PRIMARY KEY NOT NULL,
`userId` text NOT NULL,
`expires` integer NOT NULL,
FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `user_setting` (
`id` text PRIMARY KEY NOT NULL,
`user_id` text NOT NULL,
`color_scheme` text DEFAULT 'environment' NOT NULL,
`language` text DEFAULT 'en' NOT NULL,
`default_board` text DEFAULT 'default' NOT NULL,
`first_day_of_week` text DEFAULT 'monday' NOT NULL,
`search_template` text DEFAULT 'https://google.com/search?q=%s' NOT NULL,
`open_search_in_new_tab` integer DEFAULT true NOT NULL,
`disable_ping_pulse` integer DEFAULT false NOT NULL,
`replace_ping_with_icons` integer DEFAULT false NOT NULL,
`use_debug_language` integer DEFAULT false NOT NULL,
`auto_focus_search` integer DEFAULT false NOT NULL,
FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `user` (
`id` text PRIMARY KEY NOT NULL,
`name` text,
`email` text,
`emailVerified` integer,
`image` text,
`password` text,
`salt` text,
`is_admin` integer DEFAULT false NOT NULL,
`is_owner` integer DEFAULT false NOT NULL
);
--> statement-breakpoint
CREATE TABLE `verificationToken` (
`identifier` text NOT NULL,
`token` text NOT NULL,
`expires` integer NOT NULL,
PRIMARY KEY(`identifier`, `token`)
);
--> statement-breakpoint
CREATE INDEX `userId_idx` ON `account` (`userId`);--> statement-breakpoint
CREATE UNIQUE INDEX `invite_token_unique` ON `invite` (`token`);--> statement-breakpoint
CREATE INDEX `user_id_idx` ON `session` (`userId`);