mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 08:50:56 +01:00
* chore: add initial db migration * test: add unit tests for packages auth, common, widgets * fix: deep source issues * fix: format issues * wip: add unit tests for api routers * fix: deep source issues * test: add missing unit tests for integration router * wip: board tests * test: add unit tests for board router * fix: remove unnecessary null assertions * fix: deepsource issues * fix: formatting * fix: pnpm lock * fix: lint and typecheck issues * chore: address pull request feedback * fix: non-null assertions * fix: lockfile broken
112 lines
3.7 KiB
SQL
112 lines
3.7 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 `board` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`name` text NOT NULL,
|
|
`is_public` integer DEFAULT false NOT NULL,
|
|
`page_title` text,
|
|
`meta_title` text,
|
|
`logo_image_url` text,
|
|
`favicon_image_url` text,
|
|
`background_image_url` text,
|
|
`background_image_attachment` text DEFAULT 'fixed' NOT NULL,
|
|
`background_image_repeat` text DEFAULT 'no-repeat' NOT NULL,
|
|
`background_image_size` text DEFAULT 'cover' NOT NULL,
|
|
`primary_color` text DEFAULT 'red' NOT NULL,
|
|
`secondary_color` text DEFAULT 'orange' NOT NULL,
|
|
`primary_shade` integer DEFAULT 6 NOT NULL,
|
|
`app_opacity` integer DEFAULT 100 NOT NULL,
|
|
`custom_css` text,
|
|
`show_right_sidebar` integer DEFAULT false NOT NULL,
|
|
`show_left_sidebar` integer DEFAULT false NOT NULL,
|
|
`column_count` integer DEFAULT 10 NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `integration_item` (
|
|
`item_id` text NOT NULL,
|
|
`integration_id` text NOT NULL,
|
|
PRIMARY KEY(`integration_id`, `item_id`),
|
|
FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `integrationSecret` (
|
|
`kind` text NOT NULL,
|
|
`value` text NOT NULL,
|
|
`updated_at` integer NOT NULL,
|
|
`integration_id` text NOT NULL,
|
|
PRIMARY KEY(`integration_id`, `kind`),
|
|
FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `integration` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`name` text NOT NULL,
|
|
`url` text NOT NULL,
|
|
`kind` text NOT NULL
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `item` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`section_id` text NOT NULL,
|
|
`kind` text NOT NULL,
|
|
`x_offset` integer NOT NULL,
|
|
`y_offset` integer NOT NULL,
|
|
`width` integer NOT NULL,
|
|
`height` integer NOT NULL,
|
|
`options` text DEFAULT '{"json": {}}' NOT NULL,
|
|
FOREIGN KEY (`section_id`) REFERENCES `section`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE TABLE `section` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`board_id` text NOT NULL,
|
|
`kind` text NOT NULL,
|
|
`position` integer NOT NULL,
|
|
`name` text,
|
|
FOREIGN KEY (`board_id`) REFERENCES `board`(`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` (
|
|
`id` text PRIMARY KEY NOT NULL,
|
|
`name` text,
|
|
`email` text,
|
|
`emailVerified` integer,
|
|
`image` text,
|
|
`password` text,
|
|
`salt` text
|
|
);
|
|
--> 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 INDEX `integration_secret__kind_idx` ON `integrationSecret` (`kind`);--> statement-breakpoint
|
|
CREATE INDEX `integration_secret__updated_at_idx` ON `integrationSecret` (`updated_at`);--> statement-breakpoint
|
|
CREATE INDEX `integration__kind_idx` ON `integration` (`kind`);--> statement-breakpoint
|
|
CREATE INDEX `user_id_idx` ON `session` (`userId`); |