Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

feat: #420 reimplement icon picker (#421)

Manuel60a35e258363
diff --git a/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx b/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx
index 367092e30..d024a9c36 100644
--- a/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx
+++ b/apps/nextjs/src/app/[locale]/manage/apps/_form.tsx
@@ -9,7 +9,8 @@ import { useI18n } from "@homarr/translation/client";
import type { z } from "@homarr/validation";
import { validation } from "@homarr/validation";
-// TODO: add icon picker
+import { IconPicker } from "~/components/icons/picker/icon-picker";
+
type FormType = z.infer<typeof validation.app.manage>;
interface AppFormProps {
@@ -38,10 +39,11 @@ export const AppForm = (props: AppFormProps) => {
<form onSubmit={form.onSubmit(handleSubmit)}>
<Stack>
<TextInput {...form.getInputProps("name")} withAsterisk label="Name" />
- <TextInput
- {...form.getInputProps("iconUrl")}
- withAsterisk
- label="Icon URL"
+ <IconPicker
+ initialValue={initialValues?.iconUrl}
+ onChange={(iconUrl) => {
+ form.setFieldValue("iconUrl", iconUrl);
+ }}
/>
<Textarea {...form.getInputProps("description")} label="Description" />
<TextInput {...form.getInputProps("href")} label="URL" />
diff --git a/apps/nextjs/src/app/[locale]/manage/integrations/new/_integration-new-dropdown.tsx b/apps/nextjs/src/app/[locale]/manage/integrations/new/_integration-new-dropdown.tsx
index 221b5dad7..f2f558a63 100644
--- a/apps/nextjs/src/app/[locale]/manage/integrations/new/_integration-new-dropdown.tsx
+++ b/apps/nextjs/src/app/[locale]/manage/integrations/new/_integration-new-dropdown.tsx
@@ -1,6 +1,7 @@
"use client";
-import React, { ChangeEvent, useMemo, useState } from "react";
+import type { ChangeEvent } from "react";
+import React, { useMemo, useState } from "react";
import Link from "next/link";
import { Group, Menu, ScrollArea, Stack, Text, TextInput } from "@mantine/core";
import { IconSearch } from "@tabler/icons-react";
diff --git a/apps/nextjs/src/components/icons/picker/icon-picker.tsx b/apps/nextjs/src/components/icons/picker/icon-picker.tsx
new file mode 100644
index 000000000..f03b0a329
--- /dev/null
+++ b/apps/nextjs/src/components/icons/picker/icon-picker.tsx
@@ -0,0 +1,118 @@
+import { useState } from "react";
+import {
+ Combobox,
+ Group,
+ Image,
+ InputBase,
+ Skeleton,
+ Text,
+ useCombobox,
+} from "@mantine/core";
+
+import { clientApi } from "@homarr/api/client";
+import { useScopedI18n } from "@homarr/translation/client";
+
+interface IconPickerProps {
+ initialValue?: string;
+ onChange: (iconUrl: string) => void;
+}
+
+export const IconPicker = ({ initialValue, onChange }: IconPickerProps) => {
+ const [value, setValue] = useState<string>(initialValue ?? "");
+ const [search, setSearch] = useState(initialValue ?? "");
+
+ const t = useScopedI18n("common");
+
+ const { data, isFetching } = clientApi.icon.findIcons.useQuery({
+ searchText: search,
+ });
+
+ const combobox = useCombobox({
+ onDropdownClose: () => combobox.resetSelectedOption(),
+ });
+
+ const notNullableData = data?.icons ?? [];
+
+ const totalOptions = notNullableData.reduce(
+ (acc, group) => acc + group.icons.length,
+ 0,
+ );
+
+ const groups = notNullableData.map((group) => {
+ const options = group.icons.map((item) => (
+ <Combobox.Option value={item.url} key={item.id}>
+ <Group>
+ <Image src={item.url} w={20} h={20} />
+ <Text>{item.name}</Text>
+ </Group>
+ </Combobox.Option>
+ ));
+
+ return (
+ <Combobox.Group label={group.slug} key={group.id}>
+ {options}
+ </Combobox.Group>
+ );
+ });
+
+ return (
+ <Combobox
+ onOptionSubmit={(value) => {
+ setValue(value);
+ setSearch(value);
+ onChange(value);
+ combobox.closeDropdown();
+ }}
+ store={combobox}
+ withinPortal
+ >
+ <Combobox.Target>
+ <InputBase
+ rightSection={<Combobox.Chevron />}
+ value={search}
+ onChange={(event) => {
+ combobox.openDropdown();
+ combobox.updateSelectedOptionIndex();
+ setSearch(event.currentTarget.value);
+ }}
+ onClick={() => combobox.openDropdown()}
+ onFocus={() => combobox.openDropdown()}
+ onBlur={() => {
+ combobox.closeDropdown();
+ setSearch(value || "");
+ }}
+ rightSectionPointerEvents="none"
+ withAsterisk
+ label="Icon URL"
+ />
+ </Combobox.Target>
+
+ <Combobox.Dropdown>
+ <Combobox.Header>
+ <Text c="dimmed">
+ {t("iconPicker.header", { countIcons: data?.countIcons })}
+ </Text>
+ </Combobox.Header>
+ <Combobox.Options mah={350} style={{ overflowY: "auto" }}>
+ {totalOptions > 0 ? (
+ groups
+ ) : !isFetching ? (
+ <Combobox.Empty>{t("search.nothingFound")}</Combobox.Empty>
+ ) : (
+ Array(15)
+ .fill(0)
+ .map((_, index: number) => (
+ <Combobox.Option
+ value={`skeleton-${index}`}
+ key={index}
+ disabled
+ >
+ <Skeleton height={25} visible />
+ </Combobox.Option>
+ ))
+ )}
+ </Combobox.Options>
+ </Combobox.Dropdown>
+ </Combobox>
+ );
+};
diff --git a/apps/tasks/package.json b/apps/tasks/package.json
index e81e54cf9..849b1602c 100644
--- a/apps/tasks/package.json
+++ b/apps/tasks/package.json
@@ -26,7 +26,8 @@
"@homarr/redis": "workspace:^0.1.0",
"@homarr/validation": "workspace:^0.1.0",
"dotenv": "^16.4.5",
- "node-cron": "^3.0.3"
+ "node-cron": "^3.0.3",
+ "@homarr/icons": "workspace:^0.1.0"
},
"devDependencies": {
"@homarr/eslint-config": "workspace:^0.2.0",
diff --git a/apps/tasks/src/jobs.ts b/apps/tasks/src/jobs.ts
index dbaddab0b..39fcb0113 100644
--- a/apps/tasks/src/jobs.ts
+++ b/apps/tasks/src/jobs.ts
@@ -1,3 +1,4 @@
+import { iconsUpdaterJob } from "~/jobs/icons-updater";
import { queuesJob } from "./jobs/queue";
import { createJobGroup } from "./lib/cron-job/group";
@@ -6,4 +7,5 @@ export const jobs = createJobGroup({
// This job is used to process queues.
queues: queuesJob,
+ iconsUpdater: iconsUpdaterJob,
});
diff --git a/apps/tasks/src/jobs/icons-updater.ts b/apps/tasks/src/jobs/icons-updater.ts
new file mode 100644
index 000000000..42ae791f8
--- /dev/null
+++ b/apps/tasks/src/jobs/icons-updater.ts
@@ -0,0 +1,90 @@
+import { Stopwatch } from "@homarr/common";
+import { db, eq } from "@homarr/db";
+import { createId } from "@homarr/db/client";
+import { iconRepositories, icons } from "@homarr/db/schema/sqlite";
+import { fetchIconsAsync } from "@homarr/icons";
+import { logger } from "@homarr/log";
+
+import { EVERY_WEEK } from "~/lib/cron-job/constants";
+import { createCronJob } from "~/lib/cron-job/creator";
+
+export const iconsUpdaterJob = createCronJob(EVERY_WEEK).withCallback(
+ async () => {
+ logger.info(`Updating icon repository cache...`);
+ const stopWatch = new Stopwatch();
+ const repositoryIconGroups = await fetchIconsAsync();
+ const countIcons = repositoryIconGroups
+ .map((group) => group.icons.length)
+ .reduce((partialSum, arrayLength) => partialSum + arrayLength, 0);
+ logger.info(
+ `Successfully fetched ${countIcons} icons from ${repositoryIconGroups.length} repositories within ${stopWatch.getElapsedInHumanWords()}`,
+ );
+
+ const databaseIconGroups = await db.query.iconRepositories.findMany({
+ with: {
+ icons: true,
+ },
+ });
+
+ const skippedChecksums: string[] = [];
+ let countDeleted = 0;
+ let countInserted = 0;
+
+ logger.info(`Updating icons in database...`);
+ stopWatch.reset();
+
+ await db.transaction(async (transaction) => {
+ for (const repositoryIconGroup of repositoryIconGroups) {
+ if (!repositoryIconGroup.success) {
+ continue;
+ }
+
+ const repositoryInDb = databaseIconGroups.find(
+ (dbIconGroup) => dbIconGroup.slug === repositoryIconGroup.slug,
+ );
+ const repositoryIconGroupId: string = repositoryInDb?.id ?? createId();
+ if (!repositoryInDb?.id) {
+ await transaction.insert(iconRepositories).values({
+ id: repositoryIconGroupId,
+ slug: repositoryIconGroup.slug,
+ });
+ }
+
+ for (const icon of repositoryIconGroup.icons) {
+ if (
+ databaseIconGroups
+ .flatMap((group) => group.icons)
+ .some((dbIcon) => dbIcon.checksum == icon.checksum)
+ ) {
+ skippedChecksums.push(icon.checksum);
+ continue;
+ }
+
+ await transaction.insert(icons).values({
+ id: createId(),
+ checksum: icon.checksum,
+ name: icon.fileNameWithExtension,
+ url: icon.imageUrl.href,
+ iconRepositoryId: repositoryIconGroupId,
+ });
+ countInserted++;
+ }
+ }
+
+ const deadIcons = databaseIconGroups
+ .flatMap((group) => group.icons)
+ .filter((icon) => !skippedChecksums.includes(icon.checksum));
+
+ for (const icon of deadIcons) {
+ await transaction
+ .delete(icons)
+ .where(eq(icons.checksum, icon.checksum));
+ countDeleted++;
+ }
+ });
+
+ logger.info(
+ `Updated database within ${stopWatch.getElapsedInHumanWords()} (-${countDeleted}, +${countInserted})`,
+ );
+ },
+);
diff --git a/apps/tasks/src/lib/cron-job/constants.ts b/apps/tasks/src/lib/cron-job/constants.ts
index 78025dae6..6f40f29cc 100644
--- a/apps/tasks/src/lib/cron-job/constants.ts
+++ b/apps/tasks/src/lib/cron-job/constants.ts
@@ -3,3 +3,5 @@ export const EVERY_MINUTE = "* * * * *";
export const EVERY_5_MINUTES = "*/5 * * * *";
export const EVERY_10_MINUTES = "*/10 * * * *";
export const EVERY_HOUR = "0 * * * *";
+export const EVERY_DAY = "0 0 * * */1";
+export const EVERY_WEEK = "0 0 * * 1";
diff --git a/package.json b/package.json
index dc169ac48..16e6924ca 100644
--- a/package.json
+++ b/package.json
@@ -4,7 +4,6 @@
"engines": {
"node": ">=20.12.2"
},
- "type": "module",
"packageManager": "[email protected]",
"scripts": {
"build": "turbo build",
diff --git a/packages/api/src/root.ts b/packages/api/src/root.ts
index df310363c..57da6c59b 100644
--- a/packages/api/src/root.ts
+++ b/packages/api/src/root.ts
@@ -1,6 +1,7 @@
import { appRouter as innerAppRouter } from "./router/app";
import { boardRouter } from "./router/board";
import { groupRouter } from "./router/group";
+import { iconsRouter } from "./router/icons";
import { integrationRouter } from "./router/integration";
import { inviteRouter } from "./router/invite";
import { locationRouter } from "./router/location";
@@ -19,6 +20,7 @@ export const appRouter = createTRPCRouter({
widget: widgetRouter,
location: locationRouter,
log: logRouter,
+ icon: iconsRouter,
});
// export type definition of API
diff --git a/packages/api/src/router/icons.ts b/packages/api/src/router/icons.ts
new file mode 100644
index 000000000..88b514462
--- /dev/null
+++ b/packages/api/src/router/icons.ts
@@ -0,0 +1,32 @@
+import { count, like } from "@homarr/db";
+import { icons } from "@homarr/db/schema/sqlite";
+import { validation } from "@homarr/validation";
+
+import { createTRPCRouter, publicProcedure } from "../trpc";
+
+export const iconsRouter = createTRPCRouter({
+ findIcons: publicProcedure
+ .input(validation.icons.findIcons)
+ .query(async ({ ctx, input }) => {
+ return {
+ icons: await ctx.db.query.iconRepositories.findMany({
+ with: {
+ icons: {
+ columns: {
+ id: true,
+ name: true,
+ url: true,
+ },
+ where:
+ input.searchText?.length ?? 0 > 0
+ ? like(icons.name, `%${input.searchText}%`)
+ : undefined,
+ limit: 5,
+ },
+ },
+ }),
+ countIcons:
+ (await ctx.db.select({ count: count() }).from(icons))[0]?.count ?? 0,
+ };
+ }),
+});
diff --git a/packages/common/src/index.ts b/packages/common/src/index.ts
index 0b71e6748..7b0025e68 100644
--- a/packages/common/src/index.ts
+++ b/packages/common/src/index.ts
@@ -1,3 +1,4 @@
export * from "./object";
export * from "./string";
export * from "./cookie";
+export * from "./stopwatch";
diff --git a/packages/common/src/stopwatch.ts b/packages/common/src/stopwatch.ts
new file mode 100644
index 000000000..ed15476f6
--- /dev/null
+++ b/packages/common/src/stopwatch.ts
@@ -0,0 +1,44 @@
+import dayjs from "dayjs";
+import relativeTime from "dayjs/plugin/relativeTime";
+import updateLocale from "dayjs/plugin/updateLocale";
+
+dayjs.extend(relativeTime);
+dayjs.extend(updateLocale);
+dayjs.updateLocale("en", {
+ relativeTime: {
+ future: "in %s",
+ past: "%s ago",
+ s: "one second",
+ ss: "%d seconds",
+ m: "a minute",
+ mm: "%d minutes",
+ h: "an hour",
+ hh: "%d hours",
+ d: "a day",
+ dd: "%d days",
+ M: "a month",
+ MM: "%d months",
+ y: "a year",
+ yy: "%d years",
+ },
+});
+
+export class Stopwatch {
+ private startTime: number;
+
+ constructor() {
+ this.startTime = performance.now();
+ }
+
+ getElapsedInHumanWords() {
+ const difference = performance.now() - this.startTime;
+ if (difference < 1000) {
+ return `${Math.floor(difference)} ms`;
+ }
+ return dayjs().millisecond(this.startTime).fromNow(true);
+ }
+
+ reset() {
+ this.startTime = performance.now();
+ }
+}
diff --git a/packages/db/migrations/mysql/0001_fluffy_overlord.sql b/packages/db/migrations/mysql/0001_fluffy_overlord.sql
new file mode 100644
index 000000000..d9ac14b20
--- /dev/null
+++ b/packages/db/migrations/mysql/0001_fluffy_overlord.sql
@@ -0,0 +1,16 @@
+CREATE TABLE `iconRepository` (
+ `iconRepository_id` varchar(256) NOT NULL,
+ `iconRepository_slug` varchar(150) NOT NULL,
+ CONSTRAINT `iconRepository_iconRepository_id` PRIMARY KEY(`iconRepository_id`)
+);
+--> statement-breakpoint
+CREATE TABLE `icon` (
+ `icon_id` varchar(256) NOT NULL,
+ `icon_name` varchar(250) NOT NULL,
+ `icon_url` text NOT NULL,
+ `icon_checksum` text NOT NULL,
+ `iconRepository_id` varchar(256) NOT NULL,
+ CONSTRAINT `icon_icon_id` PRIMARY KEY(`icon_id`)
+);
+--> statement-breakpoint
+ALTER TABLE `icon` ADD CONSTRAINT `icon_iconRepository_id_iconRepository_iconRepository_id_fk` FOREIGN KEY (`iconRepository_id`) REFERENCES `iconRepository`(`iconRepository_id`) ON DELETE cascade ON UPDATE no action;
\ No newline at end of file
diff --git a/packages/db/migrations/mysql/meta/0001_snapshot.json b/packages/db/migrations/mysql/meta/0001_snapshot.json
new file mode 100644
index 000000000..e9a4b6506
--- /dev/null
+++ b/packages/db/migrations/mysql/meta/0001_snapshot.json
@@ -0,0 +1,1150 @@
+{
+ "version": "5",
+ "dialect": "mysql",
+ "id": "a0501765-33d6-42d1-930e-8d9106a3d9f5",
+ "prevId": "47dc6887-a308-480d-8125-183412fe7fa7",
+ "tables": {
+ "account": {
+ "name": "account",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "userId_idx": {
+ "name": "userId_idx",
+ "columns": ["userId"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_providerAccountId_pk": {
+ "name": "account_provider_providerAccountId_pk",
+ "columns": ["provider", "providerAccountId"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "app": {
+ "name": "app",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "href": {
+ "name": "href",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "app_id": {
+ "name": "app_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "boardGroupPermission": {
+ "name": "boardGroupPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardGroupPermission_board_id_board_id_fk": {
+ "name": "boardGroupPermission_board_id_board_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardGroupPermission_group_id_group_id_fk": {
+ "name": "boardGroupPermission_group_id_group_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardGroupPermission_board_id_group_id_permission_pk": {
+ "name": "boardGroupPermission_board_id_group_id_permission_pk",
+ "columns": ["board_id", "group_id", "permission"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "boardUserPermission": {
+ "name": "boardUserPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardUserPermission_board_id_board_id_fk": {
+ "name": "boardUserPermission_board_id_board_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardUserPermission_user_id_user_id_fk": {
+ "name": "boardUserPermission_user_id_user_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardUserPermission_board_id_user_id_permission_pk": {
+ "name": "boardUserPermission_board_id_user_id_permission_pk",
+ "columns": ["board_id", "user_id", "permission"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "board": {
+ "name": "board",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "boolean",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "page_title": {
+ "name": "page_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "meta_title": {
+ "name": "meta_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "logo_image_url": {
+ "name": "logo_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "favicon_image_url": {
+ "name": "favicon_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_url": {
+ "name": "background_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_attachment": {
+ "name": "background_image_attachment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('fixed')"
+ },
+ "background_image_repeat": {
+ "name": "background_image_repeat",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('no-repeat')"
+ },
+ "background_image_size": {
+ "name": "background_image_size",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('cover')"
+ },
+ "primary_color": {
+ "name": "primary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('#fa5252')"
+ },
+ "secondary_color": {
+ "name": "secondary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('#fd7e14')"
+ },
+ "opacity": {
+ "name": "opacity",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 100
+ },
+ "custom_css": {
+ "name": "custom_css",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "column_count": {
+ "name": "column_count",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 10
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "board_creator_id_user_id_fk": {
+ "name": "board_creator_id_user_id_fk",
+ "tableFrom": "board",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "board_id": {
+ "name": "board_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {
+ "board_name_unique": {
+ "name": "board_name_unique",
+ "columns": ["name"]
+ }
+ }
+ },
+ "groupMember": {
+ "name": "groupMember",
+ "columns": {
+ "groupId": {
+ "name": "groupId",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupMember_groupId_group_id_fk": {
+ "name": "groupMember_groupId_group_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "group",
+ "columnsFrom": ["groupId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "groupMember_userId_user_id_fk": {
+ "name": "groupMember_userId_user_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "groupMember_groupId_userId_pk": {
+ "name": "groupMember_groupId_userId_pk",
+ "columns": ["groupId", "userId"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "groupPermission": {
+ "name": "groupPermission",
+ "columns": {
+ "groupId": {
+ "name": "groupId",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupPermission_groupId_group_id_fk": {
+ "name": "groupPermission_groupId_group_id_fk",
+ "tableFrom": "groupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["groupId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "group": {
+ "name": "group",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "varchar(64)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "group_owner_id_user_id_fk": {
+ "name": "group_owner_id_user_id_fk",
+ "tableFrom": "group",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "group_id": {
+ "name": "group_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "iconRepository": {
+ "name": "iconRepository",
+ "columns": {
+ "iconRepository_id": {
+ "name": "iconRepository_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "iconRepository_slug": {
+ "name": "iconRepository_slug",
+ "type": "varchar(150)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "iconRepository_iconRepository_id": {
+ "name": "iconRepository_iconRepository_id",
+ "columns": ["iconRepository_id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "icon": {
+ "name": "icon",
+ "columns": {
+ "icon_id": {
+ "name": "icon_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_name": {
+ "name": "icon_name",
+ "type": "varchar(250)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_checksum": {
+ "name": "icon_checksum",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "iconRepository_id": {
+ "name": "iconRepository_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "icon_iconRepository_id_iconRepository_iconRepository_id_fk": {
+ "name": "icon_iconRepository_id_iconRepository_iconRepository_id_fk",
+ "tableFrom": "icon",
+ "tableTo": "iconRepository",
+ "columnsFrom": ["iconRepository_id"],
+ "columnsTo": ["iconRepository_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "icon_icon_id": {
+ "name": "icon_icon_id",
+ "columns": ["icon_id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "integration_item": {
+ "name": "integration_item",
+ "columns": {
+ "item_id": {
+ "name": "item_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integration_item_item_id_item_id_fk": {
+ "name": "integration_item_item_id_item_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "item",
+ "columnsFrom": ["item_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_item_integration_id_integration_id_fk": {
+ "name": "integration_item_integration_id_integration_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integration_item_item_id_integration_id_pk": {
+ "name": "integration_item_item_id_integration_id_pk",
+ "columns": ["item_id", "integration_id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "integrationSecret": {
+ "name": "integrationSecret",
+ "columns": {
+ "kind": {
+ "name": "kind",
+ "type": "varchar(16)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration_secret__kind_idx": {
+ "name": "integration_secret__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ },
+ "integration_secret__updated_at_idx": {
+ "name": "integration_secret__updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "integrationSecret_integration_id_integration_id_fk": {
+ "name": "integrationSecret_integration_id_integration_id_fk",
+ "tableFrom": "integrationSecret",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationSecret_integration_id_kind_pk": {
+ "name": "integrationSecret_integration_id_kind_pk",
+ "columns": ["integration_id", "kind"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "integration": {
+ "name": "integration",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "varchar(128)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration__kind_idx": {
+ "name": "integration__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "integration_id": {
+ "name": "integration_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "invite": {
+ "name": "invite",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expiration_date": {
+ "name": "expiration_date",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "invite_creator_id_user_id_fk": {
+ "name": "invite_creator_id_user_id_fk",
+ "tableFrom": "invite",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "invite_id": {
+ "name": "invite_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {
+ "invite_token_unique": {
+ "name": "invite_token_unique",
+ "columns": ["token"]
+ }
+ }
+ },
+ "item": {
+ "name": "item",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "section_id": {
+ "name": "section_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "x_offset": {
+ "name": "x_offset",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "y_offset": {
+ "name": "y_offset",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "width": {
+ "name": "width",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "options": {
+ "name": "options",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "('{\"json\": {}}')"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "item_section_id_section_id_fk": {
+ "name": "item_section_id_section_id_fk",
+ "tableFrom": "item",
+ "tableTo": "section",
+ "columnsFrom": ["section_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "item_id": {
+ "name": "item_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "section": {
+ "name": "section",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "int",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "section_board_id_board_id_fk": {
+ "name": "section_board_id_board_id_fk",
+ "tableFrom": "section",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "section_id": {
+ "name": "section_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": ["userId"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "session_sessionToken": {
+ "name": "session_sessionToken",
+ "columns": ["sessionToken"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "user_id": {
+ "name": "user_id",
+ "columns": ["id"]
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "verificationToken": {
+ "name": "verificationToken",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "varchar(256)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "varchar(512)",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "timestamp",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verificationToken_identifier_token_pk": {
+ "name": "verificationToken_identifier_token_pk",
+ "columns": ["identifier", "token"]
+ }
+ },
+ "uniqueConstraints": {}
+ }
+ },
+ "schemas": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ }
+}
diff --git a/packages/db/migrations/mysql/meta/_journal.json b/packages/db/migrations/mysql/meta/_journal.json
index 739d1c670..3d57e7771 100644
--- a/packages/db/migrations/mysql/meta/_journal.json
+++ b/packages/db/migrations/mysql/meta/_journal.json
@@ -8,6 +8,13 @@
"when": 1714817536714,
"tag": "0000_hot_mandrill",
"breakpoints": true
+ },
+ {
+ "idx": 1,
+ "version": "5",
+ "when": 1714854892785,
+ "tag": "0001_fluffy_overlord",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/migrations/sqlite/0001_unusual_rage.sql b/packages/db/migrations/sqlite/0001_unusual_rage.sql
new file mode 100644
index 000000000..2525f98cd
--- /dev/null
+++ b/packages/db/migrations/sqlite/0001_unusual_rage.sql
@@ -0,0 +1,13 @@
+CREATE TABLE `iconRepository` (
+ `iconRepository_id` text PRIMARY KEY NOT NULL,
+ `iconRepository_slug` text NOT NULL
+);
+--> statement-breakpoint
+CREATE TABLE `icon` (
+ `icon_id` text PRIMARY KEY NOT NULL,
+ `icon_name` text NOT NULL,
+ `icon_url` text NOT NULL,
+ `icon_checksum` text NOT NULL,
+ `iconRepository_id` text NOT NULL,
+ FOREIGN KEY (`iconRepository_id`) REFERENCES `iconRepository`(`iconRepository_id`) ON UPDATE no action ON DELETE cascade
+);
diff --git a/packages/db/migrations/sqlite/meta/0001_snapshot.json b/packages/db/migrations/sqlite/meta/0001_snapshot.json
new file mode 100644
index 000000000..8a7cb7a93
--- /dev/null
+++ b/packages/db/migrations/sqlite/meta/0001_snapshot.json
@@ -0,0 +1,1097 @@
+{
+ "version": "5",
+ "dialect": "sqlite",
+ "id": "9c0ec74f-5e23-4b11-9a28-5cb6423b4730",
+ "prevId": "116fcd87-09c7-4c7c-b590-0ed5681ffdc5",
+ "tables": {
+ "account": {
+ "name": "account",
+ "columns": {
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "provider": {
+ "name": "provider",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "providerAccountId": {
+ "name": "providerAccountId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "refresh_token": {
+ "name": "refresh_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "access_token": {
+ "name": "access_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "expires_at": {
+ "name": "expires_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_type": {
+ "name": "token_type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "scope": {
+ "name": "scope",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "id_token": {
+ "name": "id_token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "session_state": {
+ "name": "session_state",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "userId_idx": {
+ "name": "userId_idx",
+ "columns": ["userId"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "account_userId_user_id_fk": {
+ "name": "account_userId_user_id_fk",
+ "tableFrom": "account",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "account_provider_providerAccountId_pk": {
+ "columns": ["provider", "providerAccountId"],
+ "name": "account_provider_providerAccountId_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "app": {
+ "name": "app",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "href": {
+ "name": "href",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "boardGroupPermission": {
+ "name": "boardGroupPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "group_id": {
+ "name": "group_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardGroupPermission_board_id_board_id_fk": {
+ "name": "boardGroupPermission_board_id_board_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardGroupPermission_group_id_group_id_fk": {
+ "name": "boardGroupPermission_group_id_group_id_fk",
+ "tableFrom": "boardGroupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["group_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardGroupPermission_board_id_group_id_permission_pk": {
+ "columns": ["board_id", "group_id", "permission"],
+ "name": "boardGroupPermission_board_id_group_id_permission_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "boardUserPermission": {
+ "name": "boardUserPermission",
+ "columns": {
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_id": {
+ "name": "user_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "boardUserPermission_board_id_board_id_fk": {
+ "name": "boardUserPermission_board_id_board_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "boardUserPermission_user_id_user_id_fk": {
+ "name": "boardUserPermission_user_id_user_id_fk",
+ "tableFrom": "boardUserPermission",
+ "tableTo": "user",
+ "columnsFrom": ["user_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "boardUserPermission_board_id_user_id_permission_pk": {
+ "columns": ["board_id", "permission", "user_id"],
+ "name": "boardUserPermission_board_id_user_id_permission_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "board": {
+ "name": "board",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_public": {
+ "name": "is_public",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "page_title": {
+ "name": "page_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "meta_title": {
+ "name": "meta_title",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "logo_image_url": {
+ "name": "logo_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "favicon_image_url": {
+ "name": "favicon_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_url": {
+ "name": "background_image_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "background_image_attachment": {
+ "name": "background_image_attachment",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'fixed'"
+ },
+ "background_image_repeat": {
+ "name": "background_image_repeat",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'no-repeat'"
+ },
+ "background_image_size": {
+ "name": "background_image_size",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'cover'"
+ },
+ "primary_color": {
+ "name": "primary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#fa5252'"
+ },
+ "secondary_color": {
+ "name": "secondary_color",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'#fd7e14'"
+ },
+ "opacity": {
+ "name": "opacity",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 100
+ },
+ "custom_css": {
+ "name": "custom_css",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "column_count": {
+ "name": "column_count",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 10
+ }
+ },
+ "indexes": {
+ "board_name_unique": {
+ "name": "board_name_unique",
+ "columns": ["name"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "board_creator_id_user_id_fk": {
+ "name": "board_creator_id_user_id_fk",
+ "tableFrom": "board",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "groupMember": {
+ "name": "groupMember",
+ "columns": {
+ "groupId": {
+ "name": "groupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupMember_groupId_group_id_fk": {
+ "name": "groupMember_groupId_group_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "group",
+ "columnsFrom": ["groupId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "groupMember_userId_user_id_fk": {
+ "name": "groupMember_userId_user_id_fk",
+ "tableFrom": "groupMember",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "groupMember_groupId_userId_pk": {
+ "columns": ["groupId", "userId"],
+ "name": "groupMember_groupId_userId_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "groupPermission": {
+ "name": "groupPermission",
+ "columns": {
+ "groupId": {
+ "name": "groupId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "permission": {
+ "name": "permission",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "groupPermission_groupId_group_id_fk": {
+ "name": "groupPermission_groupId_group_id_fk",
+ "tableFrom": "groupPermission",
+ "tableTo": "group",
+ "columnsFrom": ["groupId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "group": {
+ "name": "group",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "owner_id": {
+ "name": "owner_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "group_owner_id_user_id_fk": {
+ "name": "group_owner_id_user_id_fk",
+ "tableFrom": "group",
+ "tableTo": "user",
+ "columnsFrom": ["owner_id"],
+ "columnsTo": ["id"],
+ "onDelete": "set null",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "iconRepository": {
+ "name": "iconRepository",
+ "columns": {
+ "iconRepository_id": {
+ "name": "iconRepository_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "iconRepository_slug": {
+ "name": "iconRepository_slug",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "icon": {
+ "name": "icon",
+ "columns": {
+ "icon_id": {
+ "name": "icon_id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_name": {
+ "name": "icon_name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_url": {
+ "name": "icon_url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "icon_checksum": {
+ "name": "icon_checksum",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "iconRepository_id": {
+ "name": "iconRepository_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "icon_iconRepository_id_iconRepository_iconRepository_id_fk": {
+ "name": "icon_iconRepository_id_iconRepository_iconRepository_id_fk",
+ "tableFrom": "icon",
+ "tableTo": "iconRepository",
+ "columnsFrom": ["iconRepository_id"],
+ "columnsTo": ["iconRepository_id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "integration_item": {
+ "name": "integration_item",
+ "columns": {
+ "item_id": {
+ "name": "item_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "integration_item_item_id_item_id_fk": {
+ "name": "integration_item_item_id_item_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "item",
+ "columnsFrom": ["item_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "integration_item_integration_id_integration_id_fk": {
+ "name": "integration_item_integration_id_integration_id_fk",
+ "tableFrom": "integration_item",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integration_item_item_id_integration_id_pk": {
+ "columns": ["integration_id", "item_id"],
+ "name": "integration_item_item_id_integration_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "integrationSecret": {
+ "name": "integrationSecret",
+ "columns": {
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "value": {
+ "name": "value",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "updated_at": {
+ "name": "updated_at",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "integration_id": {
+ "name": "integration_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration_secret__kind_idx": {
+ "name": "integration_secret__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ },
+ "integration_secret__updated_at_idx": {
+ "name": "integration_secret__updated_at_idx",
+ "columns": ["updated_at"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "integrationSecret_integration_id_integration_id_fk": {
+ "name": "integrationSecret_integration_id_integration_id_fk",
+ "tableFrom": "integrationSecret",
+ "tableTo": "integration",
+ "columnsFrom": ["integration_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "integrationSecret_integration_id_kind_pk": {
+ "columns": ["integration_id", "kind"],
+ "name": "integrationSecret_integration_id_kind_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "integration": {
+ "name": "integration",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "url": {
+ "name": "url",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "integration__kind_idx": {
+ "name": "integration__kind_idx",
+ "columns": ["kind"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "invite": {
+ "name": "invite",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expiration_date": {
+ "name": "expiration_date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "creator_id": {
+ "name": "creator_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "invite_token_unique": {
+ "name": "invite_token_unique",
+ "columns": ["token"],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {
+ "invite_creator_id_user_id_fk": {
+ "name": "invite_creator_id_user_id_fk",
+ "tableFrom": "invite",
+ "tableTo": "user",
+ "columnsFrom": ["creator_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "item": {
+ "name": "item",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "section_id": {
+ "name": "section_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "x_offset": {
+ "name": "x_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "y_offset": {
+ "name": "y_offset",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "width": {
+ "name": "width",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "height": {
+ "name": "height",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "options": {
+ "name": "options",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'{\"json\": {}}'"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "item_section_id_section_id_fk": {
+ "name": "item_section_id_section_id_fk",
+ "tableFrom": "item",
+ "tableTo": "section",
+ "columnsFrom": ["section_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "section": {
+ "name": "section",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "board_id": {
+ "name": "board_id",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "kind": {
+ "name": "kind",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "position": {
+ "name": "position",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "section_board_id_board_id_fk": {
+ "name": "section_board_id_board_id_fk",
+ "tableFrom": "section",
+ "tableTo": "board",
+ "columnsFrom": ["board_id"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "session": {
+ "name": "session",
+ "columns": {
+ "sessionToken": {
+ "name": "sessionToken",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "userId": {
+ "name": "userId",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "user_id_idx": {
+ "name": "user_id_idx",
+ "columns": ["userId"],
+ "isUnique": false
+ }
+ },
+ "foreignKeys": {
+ "session_userId_user_id_fk": {
+ "name": "session_userId_user_id_fk",
+ "tableFrom": "session",
+ "tableTo": "user",
+ "columnsFrom": ["userId"],
+ "columnsTo": ["id"],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "user": {
+ "name": "user",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "text",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "email": {
+ "name": "email",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "emailVerified": {
+ "name": "emailVerified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "image": {
+ "name": "image",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "password": {
+ "name": "password",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "salt": {
+ "name": "salt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "verificationToken": {
+ "name": "verificationToken",
+ "columns": {
+ "identifier": {
+ "name": "identifier",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "token": {
+ "name": "token",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "expires": {
+ "name": "expires",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {
+ "verificationToken_identifier_token_pk": {
+ "columns": ["identifier", "token"],
+ "name": "verificationToken_identifier_token_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ }
+ },
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ }
+}
diff --git a/packages/db/migrations/sqlite/meta/_journal.json b/packages/db/migrations/sqlite/meta/_journal.json
index 70a20525a..de71b6850 100644
--- a/packages/db/migrations/sqlite/meta/_journal.json
+++ b/packages/db/migrations/sqlite/meta/_journal.json
@@ -8,6 +8,13 @@
"when": 1714817544524,
"tag": "0000_premium_forgotten_one",
"breakpoints": true
+ },
+ {
+ "idx": 1,
+ "version": "5",
+ "when": 1714854863811,
+ "tag": "0001_unusual_rage",
+ "breakpoints": true
}
]
}
diff --git a/packages/db/package.json b/packages/db/package.json
index 074b204fa..92a2f5341 100644
--- a/packages/db/package.json
+++ b/packages/db/package.json
@@ -21,7 +21,7 @@
"migration:run": "tsx ./migrate.ts",
"migration:mysql:generate": "drizzle-kit generate:mysql --config ./mysql.config.ts",
"push": "drizzle-kit push:sqlite --config ./sqlite.config.ts",
- "studio": "drizzle-kit studio --config ./sqlite.config.ts",
+ "studio": "drizzle-kit studio",
"typecheck": "tsc --noEmit"
},
"dependencies": {
diff --git a/packages/db/schema/mysql.ts b/packages/db/schema/mysql.ts
index adbf0eb22..132a54767 100644
--- a/packages/db/schema/mysql.ts
+++ b/packages/db/schema/mysql.ts
@@ -285,6 +285,21 @@ export const integrationItems = mysqlTable(
}),
);
+export const icons = mysqlTable("icon", {
+ id: varchar("icon_id", { length: 256 }).notNull().primaryKey(),
+ name: varchar("icon_name", { length: 250 }).notNull(),
+ url: text("icon_url").notNull(),
+ checksum: text("icon_checksum").notNull(),
+ iconRepositoryId: varchar("iconRepository_id", { length: 256 })
+ .notNull()
+ .references(() => iconRepositories.id, { onDelete: "cascade" }),
+});
+
+export const iconRepositories = mysqlTable("iconRepository", {
+ id: varchar("iconRepository_id", { length: 256 }).notNull().primaryKey(),
+ slug: varchar("iconRepository_slug", { length: 150 }).notNull(),
+});
+
export const accountRelations = relations(accounts, ({ one }) => ({
user: one(users, {
fields: [accounts.userId],
@@ -301,6 +316,20 @@ export const userRelations = relations(users, ({ many }) => ({
invites: many(invites),
}));
+export const iconRelations = relations(icons, ({ one }) => ({
+ repository: one(iconRepositories, {
+ fields: [icons.iconRepositoryId],
+ references: [iconRepositories.id],
+ }),
+}));
+
+export const iconRepositoryRelations = relations(
+ iconRepositories,
+ ({ many }) => ({
+ icons: many(icons),
+ }),
+);
+
export const inviteRelations = relations(invites, ({ one }) => ({
creator: one(users, {
fields: [invites.creatorId],
diff --git a/packages/db/schema/sqlite.ts b/packages/db/schema/sqlite.ts
index 7044a0815..a8ed08889 100644
--- a/packages/db/schema/sqlite.ts
+++ b/packages/db/schema/sqlite.ts
@@ -282,6 +282,21 @@ export const integrationItems = sqliteTable(
}),
);
+export const icons = sqliteTable("icon", {
+ id: text("icon_id").notNull().primaryKey(),
+ name: text("icon_name").notNull(),
+ url: text("icon_url").notNull(),
+ checksum: text("icon_checksum").notNull(),
+ iconRepositoryId: text("iconRepository_id")
+ .notNull()
+ .references(() => iconRepositories.id, { onDelete: "cascade" }),
+});
+
+export const iconRepositories = sqliteTable("iconRepository", {
+ id: text("iconRepository_id").notNull().primaryKey(),
+ slug: text("iconRepository_slug").notNull(),
+});
+
export const accountRelations = relations(accounts, ({ one }) => ({
user: one(users, {
fields: [accounts.userId],
@@ -298,6 +313,20 @@ export const userRelations = relations(users, ({ many }) => ({
invites: many(invites),
}));
+export const iconRelations = relations(icons, ({ one }) => ({
+ repository: one(iconRepositories, {
+ fields: [icons.iconRepositoryId],
+ references: [iconRepositories.id],
+ }),
+}));
+
+export const iconRepositoryRelations = relations(
+ iconRepositories,
+ ({ many }) => ({
+ icons: many(icons),
+ }),
+);
+
export const inviteRelations = relations(invites, ({ one }) => ({
creator: one(users, {
fields: [invites.creatorId],
diff --git a/packages/icons/index.ts b/packages/icons/index.ts
new file mode 100644
index 000000000..eb96ce46b
--- /dev/null
+++ b/packages/icons/index.ts
@@ -0,0 +1,2 @@
+export * from "./src/icons-fetcher";
+export * from "./src/types";
diff --git a/packages/icons/package.json b/packages/icons/package.json
new file mode 100644
index 000000000..f3883cad2
--- /dev/null
+++ b/packages/icons/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "@homarr/icons",
+ "private": true,
+ "version": "0.1.0",
+ "type": "module",
+ "exports": {
+ ".": "./index.ts"
+ },
+ "typesVersions": {
+ "*": {
+ "*": [
+ "src/*"
+ ]
+ }
+ },
+ "license": "MIT",
+ "scripts": {
+ "clean": "rm -rf .turbo node_modules",
+ "lint": "eslint .",
+ "format": "prettier --check . --ignore-path ../../.gitignore",
+ "typecheck": "tsc --noEmit"
+ },
+ "dependencies": {
+ "@homarr/log": "workspace:^0.1.0"
+ },
+ "devDependencies": {
+ "@homarr/eslint-config": "workspace:^0.2.0",
+ "@homarr/prettier-config": "workspace:^0.1.0",
+ "@homarr/tsconfig": "workspace:^0.1.0",
+ "eslint": "^8.57.0",
+ "typescript": "^5.4.5"
+ },
+ "eslintConfig": {
+ "extends": [
+ "@homarr/eslint-config/base"
+ ]
+ },
+ "prettier": "@homarr/prettier-config"
+}
diff --git a/packages/icons/src/icons-fetcher.ts b/packages/icons/src/icons-fetcher.ts
new file mode 100644
index 000000000..dd3389102
--- /dev/null
+++ b/packages/icons/src/icons-fetcher.ts
@@ -0,0 +1,42 @@
+import { GitHubIconRepository } from "./repositories/github.icon-repository";
+import { JsdelivrIconRepository } from "./repositories/jsdelivr.icon-repository";
+import type { RepositoryIconGroup } from "./types";
+
+const repositories = [
+ new GitHubIconRepository(
+ "Walkxcode",
+ "walkxcode/dashboard-icons",
+ undefined,
+ new URL("https://github.com/walkxcode/dashboard-icons"),
+ new URL(
+ "https://api.github.com/repos/walkxcode/dashboard-icons/git/trees/main?recursive=true",
+ ),
+ "https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons/{0}",
+ ),
+ new JsdelivrIconRepository(
+ "Papirus",
+ "PapirusDevelopmentTeam/papirus-icon-theme",
+ "GPL-3.0",
+ new URL("https://github.com/PapirusDevelopmentTeam/papirus-icon-theme"),
+ new URL(
+ "https://data.jsdelivr.com/v1/packages/gh/PapirusDevelopmentTeam/papirus_icons@master?structure=flat",
+ ),
+ "https://cdn.jsdelivr.net/gh/PapirusDevelopmentTeam/papirus_icons/{0}",
+ ),
+ new JsdelivrIconRepository(
+ "Homelab SVG assets",
+ "loganmarchione/homelab-svg-assets",
+ "MIT",
+ new URL("https://github.com/loganmarchione/homelab-svg-assets"),
+ new URL(
+ "https://data.jsdelivr.com/v1/packages/gh/loganmarchione/homelab-svg-assets@main?structure=flat",
+ ),
+ "https://cdn.jsdelivr.net/gh/loganmarchione/homelab-svg-assets/{0}",
+ ),
+];
+
+export const fetchIconsAsync = async (): Promise<RepositoryIconGroup[]> => {
+ return await Promise.all(
+ repositories.map(async (repository) => await repository.getAllIconsAsync()),
+ );
+};
diff --git a/packages/icons/src/repositories/github.icon-repository.ts b/packages/icons/src/repositories/github.icon-repository.ts
new file mode 100644
index 000000000..a3f8a8ea7
--- /dev/null
+++ b/packages/icons/src/repositories/github.icon-repository.ts
@@ -0,0 +1,72 @@
+import type { IconRepositoryLicense } from "../types/icon-repository-license";
+import type { RepositoryIconGroup } from "../types/repository-icon-group";
+import { IconRepository } from "./icon-repository";
+
+export class GitHubIconRepository extends IconRepository {
+ constructor(
+ public readonly name: string,
+ public readonly slug: string,
+ public readonly license: IconRepositoryLicense,
+ public readonly repositoryUrl?: URL,
+ public readonly repositoryIndexingUrl?: URL,
+ public readonly repositoryBlobUrlTemplate?: string,
+ ) {
+ super(
+ name,
+ slug,
+ license,
+ repositoryUrl,
+ repositoryIndexingUrl,
+ repositoryBlobUrlTemplate,
+ );
+ }
+
+ protected async getAllIconsInternalAsync(): Promise<RepositoryIconGroup> {
+ if (!this.repositoryIndexingUrl || !this.repositoryBlobUrlTemplate) {
+ throw new Error("Repository URLs are required for this repository");
+ }
+
+ const response = await fetch(this.repositoryIndexingUrl);
+ const listOfFiles = (await response.json()) as GitHubApiResponse;
+
+ return {
+ success: true,
+ icons: listOfFiles.tree
+ .filter((treeItem) =>
+ this.allowedImageFileTypes.some((allowedExtension) =>
+ treeItem.path.includes(allowedExtension),
+ ),
+ )
+ .map((treeItem) => {
+ const fileNameWithExtension =
+ this.getFileNameWithoutExtensionFromPath(treeItem.path);
+
+ return {
+ imageUrl: new URL(
+ this.repositoryBlobUrlTemplate!.replace("{0}", treeItem.path),
+ ),
+ fileNameWithExtension: fileNameWithExtension,
+ local: false,
+ sizeInBytes: treeItem.size,
+ checksum: treeItem.sha,
+ };
+ }),
+ slug: this.slug,
+ };
+ }
+}
+
+interface GitHubApiResponse {
+ sha: string;
+ url: string;
+ tree: TreeItem[];
+ truncated: boolean;
+}
+
+export interface TreeItem {
+ path: string;
+ mode: string;
+ sha: string;
+ url: string;
+ size?: number;
+}
diff --git a/packages/icons/src/repositories/icon-repository.ts b/packages/icons/src/repositories/icon-repository.ts
new file mode 100644
index 000000000..f6eaac46a
--- /dev/null
+++ b/packages/icons/src/repositories/icon-repository.ts
@@ -0,0 +1,38 @@
+import { logger } from "@homarr/log";
+
+import type { IconRepositoryLicense } from "../types/icon-repository-license";
+import type { RepositoryIconGroup } from "../types/repository-icon-group";
+
+export abstract class IconRepository {
+ protected readonly allowedImageFileTypes = [".png", ".svg", ".jpeg"];
+
+ protected constructor(
+ public readonly name: string,
+ public readonly slug: string,
+ public readonly license: IconRepositoryLicense,
+ public readonly repositoryUrl?: URL,
+ public readonly repositoryIndexingUrl?: URL,
+ public readonly repositoryBlobUrlTemplate?: string,
+ ) {}
+
+ public async getAllIconsAsync(): Promise<RepositoryIconGroup> {
+ try {
+ return await this.getAllIconsInternalAsync();
+ } catch (err) {
+ logger.error(
+ `Unable to request icons from repository "${this.slug}": ${JSON.stringify(err)}`,
+ );
+ return {
+ success: false,
+ icons: [],
+ slug: this.slug,
+ };
+ }
+ }
+
+ protected abstract getAllIconsInternalAsync(): Promise<RepositoryIconGroup>;
+
+ protected getFileNameWithoutExtensionFromPath(path: string) {
+ return path.replace(/^.*[\\/]/, "");
+ }
+}
diff --git a/packages/icons/src/repositories/jsdelivr.icon-repository.ts b/packages/icons/src/repositories/jsdelivr.icon-repository.ts
new file mode 100644
index 000000000..fe0638ccb
--- /dev/null
+++ b/packages/icons/src/repositories/jsdelivr.icon-repository.ts
@@ -0,0 +1,63 @@
+import type { IconRepositoryLicense } from "../types/icon-repository-license";
+import type { RepositoryIconGroup } from "../types/repository-icon-group";
+import { IconRepository } from "./icon-repository";
+
+export class JsdelivrIconRepository extends IconRepository {
+ constructor(
+ public readonly name: string,
+ public readonly slug: string,
+ public readonly license: IconRepositoryLicense,
+ public readonly repositoryUrl: URL,
+ public readonly repositoryIndexingUrl: URL,
+ public readonly repositoryBlobUrlTemplate: string,
+ ) {
+ super(
+ name,
+ slug,
+ license,
+ repositoryUrl,
+ repositoryIndexingUrl,
+ repositoryBlobUrlTemplate,
+ );
+ }
+
+ protected async getAllIconsInternalAsync(): Promise<RepositoryIconGroup> {
+ const response = await fetch(this.repositoryIndexingUrl);
+ const listOfFiles = (await response.json()) as JsdelivrApiResponse;
+
+ return {
+ success: true,
+ icons: listOfFiles.files
+ .filter((file) =>
+ this.allowedImageFileTypes.some((allowedImageFileType) =>
+ file.name.includes(allowedImageFileType),
+ ),
+ )
+ .map((file) => {
+ const fileNameWithExtension =
+ this.getFileNameWithoutExtensionFromPath(file.name);
+
+ return {
+ imageUrl: new URL(
+ this.repositoryBlobUrlTemplate.replace("{0}", file.name),
+ ),
+ fileNameWithExtension: fileNameWithExtension,
+ local: false,
+ sizeInBytes: file.size,
+ checksum: file.hash,
+ };
+ }),
+ slug: this.slug,
+ };
+ }
+}
+
+interface JsdelivrApiResponse {
+ files: JsdelivrFile[];
+}
+
+interface JsdelivrFile {
+ name: string;
+ size: number;
+ hash: string;
+}
diff --git a/packages/icons/src/types/icon-repository-license.ts b/packages/icons/src/types/icon-repository-license.ts
new file mode 100644
index 000000000..a3ebe8728
--- /dev/null
+++ b/packages/icons/src/types/icon-repository-license.ts
@@ -0,0 +1 @@
+export type IconRepositoryLicense = "MIT" | "GPL-3.0" | undefined;
diff --git a/packages/icons/src/types/index.ts b/packages/icons/src/types/index.ts
new file mode 100644
index 000000000..c9e01bea7
--- /dev/null
+++ b/packages/icons/src/types/index.ts
@@ -0,0 +1,3 @@
+export * from "./icon-repository-license";
+export * from "./repository-icon-group";
+export * from "./repository-icon";
diff --git a/packages/icons/src/types/repository-icon-group.ts b/packages/icons/src/types/repository-icon-group.ts
new file mode 100644
index 000000000..7dcdc90fa
--- /dev/null
+++ b/packages/icons/src/types/repository-icon-group.ts
@@ -0,0 +1,7 @@
+import type { RepositoryIcon } from "./repository-icon";
+
+export interface RepositoryIconGroup {
+ icons: RepositoryIcon[];
+ success: boolean;
+ slug: string;
+}
diff --git a/packages/icons/src/types/repository-icon.ts b/packages/icons/src/types/repository-icon.ts
new file mode 100644
index 000000000..cb5884603
--- /dev/null
+++ b/packages/icons/src/types/repository-icon.ts
@@ -0,0 +1,7 @@
+export interface RepositoryIcon {
+ fileNameWithExtension: string;
+ sizeInBytes?: number;
+ imageUrl: URL;
+ local: boolean;
+ checksum: string;
+}
diff --git a/packages/icons/tsconfig.json b/packages/icons/tsconfig.json
new file mode 100644
index 000000000..cbe8483d9
--- /dev/null
+++ b/packages/icons/tsconfig.json
@@ -0,0 +1,8 @@
+{
+ "extends": "@homarr/tsconfig/base.json",
+ "compilerOptions": {
+ "tsBuildInfoFile": "node_modules/.cache/tsbuildinfo.json"
+ },
+ "include": ["*.ts", "src"],
+ "exclude": ["node_modules"]
+}
diff --git a/packages/translation/src/lang/en.ts b/packages/translation/src/lang/en.ts
index 06f442dc1..73bbb185f 100644
--- a/packages/translation/src/lang/en.ts
+++ b/packages/translation/src/lang/en.ts
@@ -360,6 +360,10 @@ export default {
next: "Next",
checkoutDocs: "Check out the documentation",
},
+ iconPicker: {
+ header:
+ "Type name or objects to filter for icons... Homarr will search through {countIcons} icons for you.",
+ },
notification: {
create: {
success: "Creation successful",
diff --git a/packages/validation/src/icons.ts b/packages/validation/src/icons.ts
new file mode 100644
index 000000000..031878b99
--- /dev/null
+++ b/packages/validation/src/icons.ts
@@ -0,0 +1,9 @@
+import { z } from "zod";
+
+const findIconsSchema = z.object({
+ searchText: z.string().optional(),
+});
+
+export const iconsSchemas = {
+ findIcons: findIconsSchema,
+};
diff --git a/packages/validation/src/index.ts b/packages/validation/src/index.ts
index a9436b90a..6d873cfb4 100644
--- a/packages/validation/src/index.ts
+++ b/packages/validation/src/index.ts
@@ -1,6 +1,7 @@
import { appSchemas } from "./app";
import { boardSchemas } from "./board";
import { groupSchemas } from "./group";
+import { iconsSchemas } from "./icons";
import { integrationSchemas } from "./integration";
import { locationSchemas } from "./location";
import { userSchemas } from "./user";
@@ -14,6 +15,7 @@ export const validation = {
app: appSchemas,
widget: widgetSchemas,
location: locationSchemas,
+ icons: iconsSchemas,
};
export { createSectionSchema, sharedItemSchema } from "./shared";
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 1c0aa7cbe..c0183d750 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -235,6 +235,9 @@ importers:
'@homarr/definitions':
specifier: workspace:^0.1.0
version: link:../../packages/definitions
+ '@homarr/icons':
+ specifier: workspace:^0.1.0
+ version: link:../../packages/icons
'@homarr/log':
specifier: workspace:^
version: link:../../packages/log
@@ -567,6 +570,28 @@ importers:
specifier: ^5.4.5
version: 5.4.5
+ packages/icons:
+ dependencies:
+ '@homarr/log':
+ specifier: workspace:^0.1.0
+ version: link:../log
+ devDependencies:
+ '@homarr/eslint-config':
+ specifier: workspace:^0.2.0
+ version: link:../../tooling/eslint
+ '@homarr/prettier-config':
+ specifier: workspace:^0.1.0
+ version: link:../../tooling/prettier
+ '@homarr/tsconfig':
+ specifier: workspace:^0.1.0
+ version: link:../../tooling/typescript
+ eslint:
+ specifier: ^8.57.0
+ version: 8.57.0
+ typescript:
+ specifier: ^5.4.5
+ version: 5.4.5
+
packages/log:
dependencies:
ioredis:
diff --git a/turbo/generators/templates/package.json.hbs b/turbo/generators/templates/package.json.hbs
index 8c2ed9ff9..6aebece9c 100644
--- a/turbo/generators/templates/package.json.hbs
+++ b/turbo/generators/templates/package.json.hbs
@@ -4,6 +4,6 @@
"format": "prettier --check . --ignore-path ../../.gitignore", "typecheck": "tsc
--noEmit" }, "devDependencies": { "@homarr/eslint-config": "workspace:^0.2.0",
"@homarr/prettier-config": "workspace:^0.1.0", "@homarr/tsconfig":
-"workspace:^0.1.0", "eslint": "^8.57.0", "typescript": "^5.4.2" },
+"workspace:^0.1.0", "eslint": "^8.57.0", "typescript": "^5.4.5" },
"eslintConfig": { "extends": [ "@homarr/eslint-config/base" ] }, "prettier":
"@homarr/prettier-config" }
\ No newline at end of file