mirror of
https://github.com/ajnart/homarr.git
synced 2026-01-29 02:39:16 +01:00
fix(deps): update dependency drizzle-kit to ^0.21.1 (#462)
* fix(deps): update dependency drizzle-kit to ^0.21.0 * fix(deps): update dependency drizzle-kit to ^0.21.1 * fix: migrate to drizzle kit 0.21 * fix: format issues * feat: add default env variables for db dialect and driver * fix: issue with driver seems to be fixed --------- Co-authored-by: homarr-renovate[bot] <158783068+homarr-renovate[bot]@users.noreply.github.com> Co-authored-by: Meier Lukas <meierschlumpf@gmail.com>
This commit is contained in:
committed by
GitHub
parent
2434e2e758
commit
1ce6fb0d0f
@@ -35,6 +35,7 @@ RUN corepack enable pnpm && pnpm install
|
||||
|
||||
COPY --from=builder /app/next-out/json/ .
|
||||
COPY --from=builder /app/next-out/pnpm-lock.yaml ./pnpm-lock.yaml
|
||||
|
||||
RUN corepack enable pnpm && pnpm install sharp -w
|
||||
|
||||
# Build the project
|
||||
@@ -42,6 +43,8 @@ COPY --from=builder /app/tasks-out/full/ .
|
||||
COPY --from=builder /app/websocket-out/full/ .
|
||||
COPY --from=builder /app/next-out/full/ .
|
||||
COPY --from=builder /app/migration-out/full/ .
|
||||
# Copy static data as it is not part of the build
|
||||
COPY static-data ./static-data
|
||||
ARG SKIP_ENV_VALIDATION=true
|
||||
RUN corepack enable pnpm && pnpm turbo run build
|
||||
|
||||
@@ -63,7 +66,6 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/websocket/wssServer.cjs ./
|
||||
COPY --from=installer --chown=nextjs:nodejs /app/node_modules/better-sqlite3/build/Release/better_sqlite3.node /app/build/better_sqlite3.node
|
||||
|
||||
COPY --from=installer --chown=nextjs:nodejs /app/packages/db/migrations ./db/migrations
|
||||
COPY --from=installer --chown=nextjs:nodejs /app/packages/db/migrate.cjs ./db/migrate.cjs
|
||||
|
||||
# Automatically leverage output traces to reduce image size
|
||||
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
||||
@@ -73,5 +75,7 @@ COPY --from=installer --chown=nextjs:nodejs /app/apps/nextjs/public ./apps/nextj
|
||||
COPY --chown=nextjs:nodejs scripts/run.sh ./run.sh
|
||||
|
||||
ENV DB_URL='/app/db/db.sqlite'
|
||||
ENV DB_DIALECT='sqlite'
|
||||
ENV DB_DRIVER='better-sqlite3'
|
||||
|
||||
CMD ["sh", "run.sh"]
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
"db:studio": "pnpm -F db studio",
|
||||
"db:migration:sqlite:generate": "pnpm -F db migration:sqlite:generate",
|
||||
"db:migration:mysql:generate": "pnpm -F db migration:mysql:generate",
|
||||
"db:migration:run": "pnpm -F db migration:run",
|
||||
"db:migration:sqlite:run": "pnpm -F db migration:sqlite:run",
|
||||
"db:migration:mysql:run": "pnpm -F db migration:mysql:run",
|
||||
"dev": "turbo dev --parallel",
|
||||
"docker:dev": "docker compose -f ./development/development.docker-compose.yml up",
|
||||
"format": "turbo format --continue -- --cache --cache-location node_modules/.cache/.prettiercache",
|
||||
|
||||
@@ -4,8 +4,8 @@ import type { Config } from "drizzle-kit";
|
||||
dotenv.config({ path: "../../.env" });
|
||||
|
||||
export default {
|
||||
dialect: "mysql",
|
||||
schema: "./schema",
|
||||
driver: "mysql2",
|
||||
dbCredentials: {
|
||||
host: process.env.DB_HOST!,
|
||||
user: process.env.DB_USER!,
|
||||
@@ -4,8 +4,8 @@ import type { Config } from "drizzle-kit";
|
||||
dotenv.config({ path: "../../.env" });
|
||||
|
||||
export default {
|
||||
dialect: "sqlite",
|
||||
schema: "./schema",
|
||||
driver: "better-sqlite",
|
||||
dbCredentials: { url: process.env.DB_URL! },
|
||||
out: "./migrations/sqlite",
|
||||
} satisfies Config;
|
||||
@@ -43,11 +43,11 @@ const initBetterSqlite = () => {
|
||||
};
|
||||
|
||||
const initMySQL2 = () => {
|
||||
if (process.env.DB_URL) {
|
||||
if (!process.env.DB_HOST) {
|
||||
connection = mysql.createConnection({ uri: process.env.DB_URL });
|
||||
} else {
|
||||
connection = mysql.createConnection({
|
||||
host: process.env.DB_HOST!,
|
||||
host: process.env.DB_HOST,
|
||||
database: process.env.DB_NAME!,
|
||||
port: Number(process.env.DB_PORT),
|
||||
user: process.env.DB_USER,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
CREATE TABLE `account` (
|
||||
`userId` varchar(256) NOT NULL,
|
||||
`userId` varchar(64) NOT NULL,
|
||||
`type` text NOT NULL,
|
||||
`provider` varchar(256) NOT NULL,
|
||||
`providerAccountId` varchar(256) NOT NULL,
|
||||
`provider` varchar(64) NOT NULL,
|
||||
`providerAccountId` varchar(64) NOT NULL,
|
||||
`refresh_token` text,
|
||||
`access_token` text,
|
||||
`expires_at` int,
|
||||
@@ -14,7 +14,7 @@ CREATE TABLE `account` (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `app` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`description` text,
|
||||
`icon_url` text NOT NULL,
|
||||
@@ -23,24 +23,24 @@ CREATE TABLE `app` (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `boardGroupPermission` (
|
||||
`board_id` text NOT NULL,
|
||||
`group_id` text NOT NULL,
|
||||
`permission` text NOT NULL,
|
||||
`board_id` varchar(64) NOT NULL,
|
||||
`group_id` varchar(64) NOT NULL,
|
||||
`permission` varchar(128) NOT NULL,
|
||||
CONSTRAINT `boardGroupPermission_board_id_group_id_permission_pk` PRIMARY KEY(`board_id`,`group_id`,`permission`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `boardUserPermission` (
|
||||
`board_id` text NOT NULL,
|
||||
`user_id` text NOT NULL,
|
||||
`permission` text NOT NULL,
|
||||
`board_id` varchar(64) NOT NULL,
|
||||
`user_id` varchar(64) NOT NULL,
|
||||
`permission` varchar(128) NOT NULL,
|
||||
CONSTRAINT `boardUserPermission_board_id_user_id_permission_pk` PRIMARY KEY(`board_id`,`user_id`,`permission`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `board` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` varchar(256) NOT NULL,
|
||||
`is_public` boolean NOT NULL DEFAULT false,
|
||||
`creator_id` text,
|
||||
`creator_id` varchar(64),
|
||||
`page_title` text,
|
||||
`meta_title` text,
|
||||
`logo_image_url` text,
|
||||
@@ -59,26 +59,41 @@ CREATE TABLE `board` (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `groupMember` (
|
||||
`groupId` varchar(256) NOT NULL,
|
||||
`userId` varchar(256) NOT NULL,
|
||||
`groupId` varchar(64) NOT NULL,
|
||||
`userId` varchar(64) NOT NULL,
|
||||
CONSTRAINT `groupMember_groupId_userId_pk` PRIMARY KEY(`groupId`,`userId`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `groupPermission` (
|
||||
`groupId` varchar(256) NOT NULL,
|
||||
`groupId` varchar(64) NOT NULL,
|
||||
`permission` text NOT NULL
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `group` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` varchar(64) NOT NULL,
|
||||
`owner_id` varchar(256),
|
||||
`owner_id` varchar(64),
|
||||
CONSTRAINT `group_id` PRIMARY KEY(`id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `iconRepository` (
|
||||
`iconRepository_id` varchar(64) NOT NULL,
|
||||
`iconRepository_slug` varchar(150) NOT NULL,
|
||||
CONSTRAINT `iconRepository_iconRepository_id` PRIMARY KEY(`iconRepository_id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `icon` (
|
||||
`icon_id` varchar(64) NOT NULL,
|
||||
`icon_name` varchar(250) NOT NULL,
|
||||
`icon_url` text NOT NULL,
|
||||
`icon_checksum` text NOT NULL,
|
||||
`iconRepository_id` varchar(64) NOT NULL,
|
||||
CONSTRAINT `icon_icon_id` PRIMARY KEY(`icon_id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `integration_item` (
|
||||
`item_id` varchar(256) NOT NULL,
|
||||
`integration_id` varchar(256) NOT NULL,
|
||||
`item_id` varchar(64) NOT NULL,
|
||||
`integration_id` varchar(64) NOT NULL,
|
||||
CONSTRAINT `integration_item_item_id_integration_id_pk` PRIMARY KEY(`item_id`,`integration_id`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
@@ -86,12 +101,12 @@ CREATE TABLE `integrationSecret` (
|
||||
`kind` varchar(16) NOT NULL,
|
||||
`value` text NOT NULL,
|
||||
`updated_at` timestamp NOT NULL,
|
||||
`integration_id` varchar(256) NOT NULL,
|
||||
`integration_id` varchar(64) NOT NULL,
|
||||
CONSTRAINT `integrationSecret_integration_id_kind_pk` PRIMARY KEY(`integration_id`,`kind`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `integration` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`url` text NOT NULL,
|
||||
`kind` varchar(128) NOT NULL,
|
||||
@@ -99,17 +114,17 @@ CREATE TABLE `integration` (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `invite` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`token` varchar(512) NOT NULL,
|
||||
`expiration_date` timestamp NOT NULL,
|
||||
`creator_id` varchar(256) NOT NULL,
|
||||
`creator_id` varchar(64) NOT NULL,
|
||||
CONSTRAINT `invite_id` PRIMARY KEY(`id`),
|
||||
CONSTRAINT `invite_token_unique` UNIQUE(`token`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `item` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`section_id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`section_id` varchar(64) NOT NULL,
|
||||
`kind` text NOT NULL,
|
||||
`x_offset` int NOT NULL,
|
||||
`y_offset` int NOT NULL,
|
||||
@@ -120,8 +135,8 @@ CREATE TABLE `item` (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `section` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`board_id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`board_id` varchar(64) NOT NULL,
|
||||
`kind` text NOT NULL,
|
||||
`position` int NOT NULL,
|
||||
`name` text,
|
||||
@@ -130,13 +145,13 @@ CREATE TABLE `section` (
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `session` (
|
||||
`sessionToken` varchar(512) NOT NULL,
|
||||
`userId` varchar(256) NOT NULL,
|
||||
`userId` varchar(64) NOT NULL,
|
||||
`expires` timestamp NOT NULL,
|
||||
CONSTRAINT `session_sessionToken` PRIMARY KEY(`sessionToken`)
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `user` (
|
||||
`id` varchar(256) NOT NULL,
|
||||
`id` varchar(64) NOT NULL,
|
||||
`name` text,
|
||||
`email` text,
|
||||
`emailVerified` timestamp,
|
||||
@@ -147,17 +162,12 @@ CREATE TABLE `user` (
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `verificationToken` (
|
||||
`identifier` varchar(256) NOT NULL,
|
||||
`identifier` varchar(64) NOT NULL,
|
||||
`token` varchar(512) NOT NULL,
|
||||
`expires` timestamp NOT NULL,
|
||||
CONSTRAINT `verificationToken_identifier_token_pk` 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`);--> statement-breakpoint
|
||||
ALTER TABLE `account` ADD CONSTRAINT `account_userId_user_id_fk` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `boardGroupPermission` ADD CONSTRAINT `boardGroupPermission_board_id_board_id_fk` FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `boardGroupPermission` ADD CONSTRAINT `boardGroupPermission_group_id_group_id_fk` FOREIGN KEY (`group_id`) REFERENCES `group`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
@@ -168,10 +178,16 @@ ALTER TABLE `groupMember` ADD CONSTRAINT `groupMember_groupId_group_id_fk` FOREI
|
||||
ALTER TABLE `groupMember` ADD CONSTRAINT `groupMember_userId_user_id_fk` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `groupPermission` ADD CONSTRAINT `groupPermission_groupId_group_id_fk` FOREIGN KEY (`groupId`) REFERENCES `group`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `group` ADD CONSTRAINT `group_owner_id_user_id_fk` FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON DELETE set null ON UPDATE no action;--> 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;--> statement-breakpoint
|
||||
ALTER TABLE `integration_item` ADD CONSTRAINT `integration_item_item_id_item_id_fk` FOREIGN KEY (`item_id`) REFERENCES `item`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `integration_item` ADD CONSTRAINT `integration_item_integration_id_integration_id_fk` FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `integrationSecret` ADD CONSTRAINT `integrationSecret_integration_id_integration_id_fk` FOREIGN KEY (`integration_id`) REFERENCES `integration`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `invite` ADD CONSTRAINT `invite_creator_id_user_id_fk` FOREIGN KEY (`creator_id`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `item` ADD CONSTRAINT `item_section_id_section_id_fk` FOREIGN KEY (`section_id`) REFERENCES `section`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `section` ADD CONSTRAINT `section_board_id_board_id_fk` FOREIGN KEY (`board_id`) REFERENCES `board`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
|
||||
ALTER TABLE `session` ADD CONSTRAINT `session_userId_user_id_fk` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;
|
||||
ALTER TABLE `session` ADD CONSTRAINT `session_userId_user_id_fk` FOREIGN KEY (`userId`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> 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`);
|
||||
@@ -1,16 +0,0 @@
|
||||
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;
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "5",
|
||||
"dialect": "mysql",
|
||||
"id": "47dc6887-a308-480d-8125-183412fe7fa7",
|
||||
"id": "fdeaf6eb-cd62-4fa5-9b38-d7f80a60db9f",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"tables": {
|
||||
"account": {
|
||||
@@ -9,7 +9,7 @@
|
||||
"columns": {
|
||||
"userId": {
|
||||
"name": "userId",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -23,14 +23,14 @@
|
||||
},
|
||||
"provider": {
|
||||
"name": "provider",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"providerAccountId": {
|
||||
"name": "providerAccountId",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -116,7 +116,7 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -165,21 +165,21 @@
|
||||
"columns": {
|
||||
"board_id": {
|
||||
"name": "board_id",
|
||||
"type": "text",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"group_id": {
|
||||
"name": "group_id",
|
||||
"type": "text",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"permission": {
|
||||
"name": "permission",
|
||||
"type": "text",
|
||||
"type": "varchar(128)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -219,21 +219,21 @@
|
||||
"columns": {
|
||||
"board_id": {
|
||||
"name": "board_id",
|
||||
"type": "text",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"user_id": {
|
||||
"name": "user_id",
|
||||
"type": "text",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"permission": {
|
||||
"name": "permission",
|
||||
"type": "text",
|
||||
"type": "varchar(128)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -273,7 +273,7 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -295,7 +295,7 @@
|
||||
},
|
||||
"creator_id": {
|
||||
"name": "creator_id",
|
||||
"type": "text",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
@@ -429,14 +429,14 @@
|
||||
"columns": {
|
||||
"groupId": {
|
||||
"name": "groupId",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"userId": {
|
||||
"name": "userId",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -476,7 +476,7 @@
|
||||
"columns": {
|
||||
"groupId": {
|
||||
"name": "groupId",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -509,7 +509,7 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -523,7 +523,7 @@
|
||||
},
|
||||
"owner_id": {
|
||||
"name": "owner_id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": false,
|
||||
"autoincrement": false
|
||||
@@ -549,19 +549,106 @@
|
||||
},
|
||||
"uniqueConstraints": {}
|
||||
},
|
||||
"iconRepository": {
|
||||
"name": "iconRepository",
|
||||
"columns": {
|
||||
"iconRepository_id": {
|
||||
"name": "iconRepository_id",
|
||||
"type": "varchar(64)",
|
||||
"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(64)",
|
||||
"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(64)",
|
||||
"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)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"integration_id": {
|
||||
"name": "integration_id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -622,7 +709,7 @@
|
||||
},
|
||||
"integration_id": {
|
||||
"name": "integration_id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -664,7 +751,7 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -712,7 +799,7 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -733,7 +820,7 @@
|
||||
},
|
||||
"creator_id": {
|
||||
"name": "creator_id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -769,14 +856,14 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"section_id": {
|
||||
"name": "section_id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -850,14 +937,14 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
},
|
||||
"board_id": {
|
||||
"name": "board_id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -916,7 +1003,7 @@
|
||||
},
|
||||
"userId": {
|
||||
"name": "userId",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -960,7 +1047,7 @@
|
||||
"columns": {
|
||||
"id": {
|
||||
"name": "id",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -1023,7 +1110,7 @@
|
||||
"columns": {
|
||||
"identifier": {
|
||||
"name": "identifier",
|
||||
"type": "varchar(256)",
|
||||
"type": "varchar(64)",
|
||||
"primaryKey": false,
|
||||
"notNull": true,
|
||||
"autoincrement": false
|
||||
@@ -1054,7 +1141,6 @@
|
||||
"uniqueConstraints": {}
|
||||
}
|
||||
},
|
||||
"schemas": {},
|
||||
"_meta": {
|
||||
"schemas": {},
|
||||
"tables": {},
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,12 @@
|
||||
{
|
||||
"version": "5",
|
||||
"version": "6",
|
||||
"dialect": "mysql",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "5",
|
||||
"when": 1714817536714,
|
||||
"tag": "0000_hot_mandrill",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "5",
|
||||
"when": 1714854892785,
|
||||
"tag": "0001_fluffy_overlord",
|
||||
"when": 1715334452118,
|
||||
"tag": "0000_harsh_photon",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
31
packages/db/migrations/mysql/migrate.ts
Normal file
31
packages/db/migrations/mysql/migrate.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
import { drizzle } from "drizzle-orm/mysql2";
|
||||
import { migrate } from "drizzle-orm/mysql2/migrator";
|
||||
import mysql from "mysql2";
|
||||
|
||||
const migrationsFolder = process.argv[2] ?? ".";
|
||||
|
||||
const mysql2 = mysql.createConnection(
|
||||
process.env.DB_HOST
|
||||
? {
|
||||
host: process.env.DB_HOST,
|
||||
database: process.env.DB_NAME!,
|
||||
port: Number(process.env.DB_PORT),
|
||||
user: process.env.DB_USER,
|
||||
password: process.env.DB_PASSWORD,
|
||||
}
|
||||
: { uri: process.env.DB_URL },
|
||||
);
|
||||
|
||||
const db = drizzle(mysql2, {
|
||||
mode: "default",
|
||||
});
|
||||
|
||||
migrate(db, { migrationsFolder })
|
||||
.then(() => {
|
||||
console.log("Migration complete");
|
||||
process.exit(0);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log("Migration failed", err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -82,6 +82,20 @@ CREATE TABLE `group` (
|
||||
FOREIGN KEY (`owner_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null
|
||||
);
|
||||
--> statement-breakpoint
|
||||
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
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `integration_item` (
|
||||
`item_id` text NOT NULL,
|
||||
`integration_id` text NOT NULL,
|
||||
@@ -1,13 +0,0 @@
|
||||
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
|
||||
);
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"version": "5",
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"id": "116fcd87-09c7-4c7c-b590-0ed5681ffdc5",
|
||||
"id": "0575873a-9e10-4480-8d7d-c47198622c22",
|
||||
"prevId": "00000000-0000-0000-0000-000000000000",
|
||||
"tables": {
|
||||
"account": {
|
||||
@@ -535,6 +535,83 @@
|
||||
"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": {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,19 +1,12 @@
|
||||
{
|
||||
"version": "5",
|
||||
"version": "6",
|
||||
"dialect": "sqlite",
|
||||
"entries": [
|
||||
{
|
||||
"idx": 0,
|
||||
"version": "5",
|
||||
"when": 1714817544524,
|
||||
"tag": "0000_premium_forgotten_one",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "5",
|
||||
"when": 1714854863811,
|
||||
"tag": "0001_unusual_rage",
|
||||
"version": "6",
|
||||
"when": 1715334238443,
|
||||
"tag": "0000_talented_ben_parker",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
|
||||
@@ -2,7 +2,7 @@ import Database from "better-sqlite3";
|
||||
import { drizzle } from "drizzle-orm/better-sqlite3";
|
||||
import { migrate } from "drizzle-orm/better-sqlite3/migrator";
|
||||
|
||||
const migrationsFolder = process.argv[2] ?? "./migrations/sqlite";
|
||||
const migrationsFolder = process.argv[2] ?? ".";
|
||||
|
||||
const sqlite = new Database(process.env.DB_URL?.replace("file:", ""));
|
||||
|
||||
@@ -13,14 +13,18 @@
|
||||
"types": "./index.ts",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "esbuild migrate.ts --bundle --platform=node --outfile=migrate.cjs",
|
||||
"build": "pnpm run build:sqlite && pnpm run build:mysql",
|
||||
"build:sqlite": "esbuild migrations/sqlite/migrate.ts --bundle --platform=node --outfile=migrations/sqlite/migrate.cjs",
|
||||
"build:mysql": "esbuild migrations/mysql/migrate.ts --bundle --platform=node --outfile=migrations/mysql/migrate.cjs",
|
||||
"clean": "rm -rf .turbo node_modules",
|
||||
"lint": "eslint .",
|
||||
"format": "prettier --check . --ignore-path ../../.gitignore",
|
||||
"migration:sqlite:generate": "drizzle-kit generate:sqlite --config ./sqlite.config.ts",
|
||||
"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",
|
||||
"migration:sqlite:generate": "drizzle-kit generate --config ./configs/sqlite.config.ts",
|
||||
"migration:sqlite:run": "drizzle-kit migrate --config ./configs/sqlite.config.ts",
|
||||
"migration:mysql:generate": "drizzle-kit generate --config ./configs/mysql.config.ts",
|
||||
"migration:mysql:run": "drizzle-kit migrate --config ./configs/mysql.config.ts",
|
||||
"push:sqlite": "drizzle-kit push --config ./configs/sqlite.config.ts",
|
||||
"push:mysql": "drizzle-kit push --config ./configs/mysql.config.ts",
|
||||
"studio": "drizzle-kit studio",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
@@ -32,7 +36,7 @@
|
||||
"better-sqlite3": "^9.6.0",
|
||||
"drizzle-orm": "^0.30.10",
|
||||
"mysql2": "3.9.7",
|
||||
"drizzle-kit": "^0.20.18"
|
||||
"drizzle-kit": "^0.21.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@homarr/eslint-config": "workspace:^0.2.0",
|
||||
|
||||
@@ -29,7 +29,7 @@ import {
|
||||
} from "@homarr/definitions";
|
||||
|
||||
export const users = mysqlTable("user", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
name: text("name"),
|
||||
email: text("email"),
|
||||
emailVerified: timestamp("emailVerified"),
|
||||
@@ -41,12 +41,12 @@ export const users = mysqlTable("user", {
|
||||
export const accounts = mysqlTable(
|
||||
"account",
|
||||
{
|
||||
userId: varchar("userId", { length: 256 })
|
||||
userId: varchar("userId", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
type: text("type").$type<AdapterAccount["type"]>().notNull(),
|
||||
provider: varchar("provider", { length: 256 }).notNull(),
|
||||
providerAccountId: varchar("providerAccountId", { length: 256 }).notNull(),
|
||||
provider: varchar("provider", { length: 64 }).notNull(),
|
||||
providerAccountId: varchar("providerAccountId", { length: 64 }).notNull(),
|
||||
refresh_token: text("refresh_token"),
|
||||
access_token: text("access_token"),
|
||||
expires_at: int("expires_at"),
|
||||
@@ -69,7 +69,7 @@ export const sessions = mysqlTable(
|
||||
sessionToken: varchar("sessionToken", { length: 512 })
|
||||
.notNull()
|
||||
.primaryKey(),
|
||||
userId: varchar("userId", { length: 256 })
|
||||
userId: varchar("userId", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
expires: timestamp("expires").notNull(),
|
||||
@@ -82,7 +82,7 @@ export const sessions = mysqlTable(
|
||||
export const verificationTokens = mysqlTable(
|
||||
"verificationToken",
|
||||
{
|
||||
identifier: varchar("identifier", { length: 256 }).notNull(),
|
||||
identifier: varchar("identifier", { length: 64 }).notNull(),
|
||||
token: varchar("token", { length: 512 }).notNull(),
|
||||
expires: timestamp("expires").notNull(),
|
||||
},
|
||||
@@ -96,10 +96,10 @@ export const verificationTokens = mysqlTable(
|
||||
export const groupMembers = mysqlTable(
|
||||
"groupMember",
|
||||
{
|
||||
groupId: varchar("groupId", { length: 256 })
|
||||
groupId: varchar("groupId", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => groups.id, { onDelete: "cascade" }),
|
||||
userId: varchar("userId", { length: 256 })
|
||||
userId: varchar("userId", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
},
|
||||
@@ -111,25 +111,25 @@ export const groupMembers = mysqlTable(
|
||||
);
|
||||
|
||||
export const groups = mysqlTable("group", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
name: varchar("name", { length: 64 }).notNull(),
|
||||
ownerId: varchar("owner_id", { length: 256 }).references(() => users.id, {
|
||||
ownerId: varchar("owner_id", { length: 64 }).references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
});
|
||||
|
||||
export const groupPermissions = mysqlTable("groupPermission", {
|
||||
groupId: varchar("groupId", { length: 256 })
|
||||
groupId: varchar("groupId", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => groups.id, { onDelete: "cascade" }),
|
||||
permission: text("permission").$type<GroupPermissionKey>().notNull(),
|
||||
});
|
||||
|
||||
export const invites = mysqlTable("invite", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
token: varchar("token", { length: 512 }).notNull().unique(),
|
||||
expirationDate: timestamp("expiration_date").notNull(),
|
||||
creatorId: varchar("creator_id", { length: 256 })
|
||||
creatorId: varchar("creator_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
});
|
||||
@@ -137,7 +137,7 @@ export const invites = mysqlTable("invite", {
|
||||
export const integrations = mysqlTable(
|
||||
"integration",
|
||||
{
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
name: text("name").notNull(),
|
||||
url: text("url").notNull(),
|
||||
kind: varchar("kind", { length: 128 }).$type<IntegrationKind>().notNull(),
|
||||
@@ -155,7 +155,7 @@ export const integrationSecrets = mysqlTable(
|
||||
.notNull(),
|
||||
value: text("value").$type<`${string}.${string}`>().notNull(),
|
||||
updatedAt: timestamp("updated_at").notNull(),
|
||||
integrationId: varchar("integration_id", { length: 256 })
|
||||
integrationId: varchar("integration_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => integrations.id, { onDelete: "cascade" }),
|
||||
},
|
||||
@@ -171,10 +171,10 @@ export const integrationSecrets = mysqlTable(
|
||||
);
|
||||
|
||||
export const boards = mysqlTable("board", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
name: varchar("name", { length: 256 }).unique().notNull(),
|
||||
isPublic: boolean("is_public").default(false).notNull(),
|
||||
creatorId: text("creator_id").references(() => users.id, {
|
||||
creatorId: varchar("creator_id", { length: 64 }).references(() => users.id, {
|
||||
onDelete: "set null",
|
||||
}),
|
||||
pageTitle: text("page_title"),
|
||||
@@ -204,13 +204,15 @@ export const boards = mysqlTable("board", {
|
||||
export const boardUserPermissions = mysqlTable(
|
||||
"boardUserPermission",
|
||||
{
|
||||
boardId: text("board_id")
|
||||
boardId: varchar("board_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => boards.id, { onDelete: "cascade" }),
|
||||
userId: text("user_id")
|
||||
userId: varchar("user_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => users.id, { onDelete: "cascade" }),
|
||||
permission: text("permission").$type<BoardPermission>().notNull(),
|
||||
permission: varchar("permission", { length: 128 })
|
||||
.$type<BoardPermission>()
|
||||
.notNull(),
|
||||
},
|
||||
(table) => ({
|
||||
compoundKey: primaryKey({
|
||||
@@ -222,13 +224,15 @@ export const boardUserPermissions = mysqlTable(
|
||||
export const boardGroupPermissions = mysqlTable(
|
||||
"boardGroupPermission",
|
||||
{
|
||||
boardId: text("board_id")
|
||||
boardId: varchar("board_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => boards.id, { onDelete: "cascade" }),
|
||||
groupId: text("group_id")
|
||||
groupId: varchar("group_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => groups.id, { onDelete: "cascade" }),
|
||||
permission: text("permission").$type<BoardPermission>().notNull(),
|
||||
permission: varchar("permission", { length: 128 })
|
||||
.$type<BoardPermission>()
|
||||
.notNull(),
|
||||
},
|
||||
(table) => ({
|
||||
compoundKey: primaryKey({
|
||||
@@ -238,8 +242,8 @@ export const boardGroupPermissions = mysqlTable(
|
||||
);
|
||||
|
||||
export const sections = mysqlTable("section", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
boardId: varchar("board_id", { length: 256 })
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
boardId: varchar("board_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => boards.id, { onDelete: "cascade" }),
|
||||
kind: text("kind").$type<SectionKind>().notNull(),
|
||||
@@ -248,8 +252,8 @@ export const sections = mysqlTable("section", {
|
||||
});
|
||||
|
||||
export const items = mysqlTable("item", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
sectionId: varchar("section_id", { length: 256 })
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
sectionId: varchar("section_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => sections.id, { onDelete: "cascade" }),
|
||||
kind: text("kind").$type<WidgetKind>().notNull(),
|
||||
@@ -261,7 +265,7 @@ export const items = mysqlTable("item", {
|
||||
});
|
||||
|
||||
export const apps = mysqlTable("app", {
|
||||
id: varchar("id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("id", { length: 64 }).notNull().primaryKey(),
|
||||
name: text("name").notNull(),
|
||||
description: text("description"),
|
||||
iconUrl: text("icon_url").notNull(),
|
||||
@@ -271,10 +275,10 @@ export const apps = mysqlTable("app", {
|
||||
export const integrationItems = mysqlTable(
|
||||
"integration_item",
|
||||
{
|
||||
itemId: varchar("item_id", { length: 256 })
|
||||
itemId: varchar("item_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => items.id, { onDelete: "cascade" }),
|
||||
integrationId: varchar("integration_id", { length: 256 })
|
||||
integrationId: varchar("integration_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => integrations.id, { onDelete: "cascade" }),
|
||||
},
|
||||
@@ -286,17 +290,17 @@ export const integrationItems = mysqlTable(
|
||||
);
|
||||
|
||||
export const icons = mysqlTable("icon", {
|
||||
id: varchar("icon_id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("icon_id", { length: 64 }).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 })
|
||||
iconRepositoryId: varchar("iconRepository_id", { length: 64 })
|
||||
.notNull()
|
||||
.references(() => iconRepositories.id, { onDelete: "cascade" }),
|
||||
});
|
||||
|
||||
export const iconRepositories = mysqlTable("iconRepository", {
|
||||
id: varchar("iconRepository_id", { length: 256 }).notNull().primaryKey(),
|
||||
id: varchar("iconRepository_id", { length: 64 }).notNull().primaryKey(),
|
||||
slug: varchar("iconRepository_slug", { length: 150 }).notNull(),
|
||||
});
|
||||
|
||||
|
||||
68
pnpm-lock.yaml
generated
68
pnpm-lock.yaml
generated
@@ -495,8 +495,8 @@ importers:
|
||||
specifier: ^9.6.0
|
||||
version: 9.6.0
|
||||
drizzle-kit:
|
||||
specifier: ^0.20.18
|
||||
version: 0.20.18
|
||||
specifier: ^0.21.1
|
||||
version: 0.21.1
|
||||
drizzle-orm:
|
||||
specifier: ^0.30.10
|
||||
version: 0.30.10(@types/better-sqlite3@7.6.10)(@types/react@18.3.1)(better-sqlite3@9.6.0)(mysql2@3.9.7)(react@18.3.1)
|
||||
@@ -1608,16 +1608,6 @@ packages:
|
||||
'@homarr/gridstack@1.0.0':
|
||||
resolution: {integrity: sha512-KM9024BipLD9BmtM6jHI8OKLZ1Iy4vZdTfU53ww4qEda/330XQYhIC2SBcQgkNnDB2MTkn/laNSO5gTy+lJg9Q==}
|
||||
|
||||
'@hono/node-server@1.11.0':
|
||||
resolution: {integrity: sha512-TLIJq9TMtD1NEG1mVoqNUn1Ita0qSaB5XboZErjFBcO/GJYXwWY4dVdTi9G0lbxtu0x+hJXDItcLaFHb7rlFTw==}
|
||||
engines: {node: '>=18.14.1'}
|
||||
|
||||
'@hono/zod-validator@0.2.1':
|
||||
resolution: {integrity: sha512-HFoxln7Q6JsE64qz2WBS28SD33UB2alp3aRKmcWnNLDzEL1BLsWfbdX6e1HIiUprHYTIXf5y7ax8eYidKUwyaA==}
|
||||
peerDependencies:
|
||||
hono: '>=3.9.0'
|
||||
zod: ^3.19.1
|
||||
|
||||
'@humanwhocodes/config-array@0.11.14':
|
||||
resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==}
|
||||
engines: {node: '>=10.10.0'}
|
||||
@@ -2732,10 +2722,6 @@ packages:
|
||||
resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==}
|
||||
engines: {node: '>= 6'}
|
||||
|
||||
camelcase@7.0.1:
|
||||
resolution: {integrity: sha512-xlx1yCK2Oc1APsPXDL2LdlNP6+uu8OCDdhOBSVT279M/S+y75O30C2VuD8T2ogdePBBl7PfPF4504tnLgX3zfw==}
|
||||
engines: {node: '>=14.16'}
|
||||
|
||||
caniuse-lite@1.0.30001587:
|
||||
resolution: {integrity: sha512-HMFNotUmLXn71BQxg8cijvqxnIAofforZOwGsxyXJ0qugTdspUF4sPSJ2vhgprHCB996tIDzEq1ubumPDV8ULA==}
|
||||
|
||||
@@ -2759,10 +2745,6 @@ packages:
|
||||
resolution: {integrity: sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
chalk@5.3.0:
|
||||
resolution: {integrity: sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==}
|
||||
engines: {node: ^12.17.0 || ^14.13 || >=16.0.0}
|
||||
|
||||
change-case@3.1.0:
|
||||
resolution: {integrity: sha512-2AZp7uJZbYEzRPsFoa+ijKdvp9zsrnnt6+yFokfwEpeJm0xuJDVoxiRCAaTzyJND8GJkofo2IcKWaUZ/OECVzw==}
|
||||
|
||||
@@ -3082,8 +3064,8 @@ packages:
|
||||
resolution: {integrity: sha512-vyJTp8+mC+G+5dfgsY+r3ckxlz+QMX40VjPQsZc5gxVAxLmi64TBoVkP54A/pRAXMXsbu2GMMBrZPxNv23waMg==}
|
||||
engines: {node: '>=0.4.0'}
|
||||
|
||||
drizzle-kit@0.20.18:
|
||||
resolution: {integrity: sha512-fLTwcnLqtBxGd+51H/dEm9TC0FW6+cIX/RVPyNcitBO77X9+nkogEfMAJebpd/8Yl4KucmePHRYRWWvUlW0rqg==}
|
||||
drizzle-kit@0.21.1:
|
||||
resolution: {integrity: sha512-Sp7OnCdROiE2ebMuHsAfrnRoHVGYCvErQxUh7/0l6R1caHssZu9oZu/hW9rLU19xnTK4/y3iSe3sL0Cc530wCg==}
|
||||
hasBin: true
|
||||
|
||||
drizzle-orm@0.30.10:
|
||||
@@ -3657,10 +3639,6 @@ packages:
|
||||
heap@0.2.7:
|
||||
resolution: {integrity: sha512-2bsegYkkHO+h/9MGbn6KWcE45cHZgPANo5LXF7EvWdT0yT2EguSVO1nDgU5c8+ZOPwp2vMNa7YFsJhVcDR9Sdg==}
|
||||
|
||||
hono@4.2.5:
|
||||
resolution: {integrity: sha512-uonJD3i/yy005kQ7bPZRVfG3rejYJwyPqBmPoUGijS4UB/qM+YlrZ7xzSWy+ByDu9buGHUG+f+SKzz03Y6V1Kw==}
|
||||
engines: {node: '>=16.0.0'}
|
||||
|
||||
html-encoding-sniffer@4.0.0:
|
||||
resolution: {integrity: sha512-Y22oTqIU4uuPgEemfz7NDJz6OeKf12Lsu+QC+s3BVpda64lTiMYCyGwg5ki4vFxkMwQdeZDl2adZoqUgdFuTgQ==}
|
||||
engines: {node: '>=18'}
|
||||
@@ -4214,10 +4192,6 @@ packages:
|
||||
resolution: {integrity: sha512-lKwV/1brpG6mBUFHtb7NUmtABCb2WZZmm2wNiOA5hAb8VdCS4B3dtMWyvcoViccwAW/COERjXLt0zP1zXUN26g==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
minimatch@7.4.6:
|
||||
resolution: {integrity: sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==}
|
||||
engines: {node: '>=10'}
|
||||
|
||||
minimatch@9.0.4:
|
||||
resolution: {integrity: sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==}
|
||||
engines: {node: '>=16 || 14 >=14.17'}
|
||||
@@ -5711,9 +5685,6 @@ packages:
|
||||
resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==}
|
||||
engines: {node: '>=12.20'}
|
||||
|
||||
zod@3.23.6:
|
||||
resolution: {integrity: sha512-RTHJlZhsRbuA8Hmp/iNL7jnfc4nZishjsanDAfEY1QpDQZCahUp3xDzl+zfweE9BklxMUcgBgS1b7Lvie/ZVwA==}
|
||||
|
||||
zod@3.23.8:
|
||||
resolution: {integrity: sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==}
|
||||
|
||||
@@ -6236,13 +6207,6 @@ snapshots:
|
||||
|
||||
'@homarr/gridstack@1.0.0': {}
|
||||
|
||||
'@hono/node-server@1.11.0': {}
|
||||
|
||||
'@hono/zod-validator@0.2.1(hono@4.2.5)(zod@3.23.6)':
|
||||
dependencies:
|
||||
hono: 4.2.5
|
||||
zod: 3.23.6
|
||||
|
||||
'@humanwhocodes/config-array@0.11.14':
|
||||
dependencies:
|
||||
'@humanwhocodes/object-schema': 2.0.2
|
||||
@@ -7478,8 +7442,6 @@ snapshots:
|
||||
|
||||
camelcase-css@2.0.1: {}
|
||||
|
||||
camelcase@7.0.1: {}
|
||||
|
||||
caniuse-lite@1.0.30001587: {}
|
||||
|
||||
case-anything@2.1.13: {}
|
||||
@@ -7510,8 +7472,6 @@ snapshots:
|
||||
ansi-styles: 4.3.0
|
||||
supports-color: 7.2.0
|
||||
|
||||
chalk@5.3.0: {}
|
||||
|
||||
change-case@3.1.0:
|
||||
dependencies:
|
||||
camel-case: 3.0.0
|
||||
@@ -7825,25 +7785,17 @@ snapshots:
|
||||
dependencies:
|
||||
wordwrap: 1.0.0
|
||||
|
||||
drizzle-kit@0.20.18:
|
||||
drizzle-kit@0.21.1:
|
||||
dependencies:
|
||||
'@esbuild-kit/esm-loader': 2.6.5
|
||||
'@hono/node-server': 1.11.0
|
||||
'@hono/zod-validator': 0.2.1(hono@4.2.5)(zod@3.23.6)
|
||||
camelcase: 7.0.1
|
||||
chalk: 5.3.0
|
||||
commander: 9.5.0
|
||||
env-paths: 3.0.0
|
||||
esbuild: 0.19.12
|
||||
esbuild-register: 3.5.0(esbuild@0.19.12)
|
||||
glob: 8.1.0
|
||||
hanji: 0.0.5
|
||||
hono: 4.2.5
|
||||
json-diff: 0.9.0
|
||||
minimatch: 7.4.6
|
||||
semver: 7.6.0
|
||||
superjson: 2.2.1
|
||||
zod: 3.23.6
|
||||
zod: 3.23.8
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
@@ -8594,8 +8546,6 @@ snapshots:
|
||||
|
||||
heap@0.2.7: {}
|
||||
|
||||
hono@4.2.5: {}
|
||||
|
||||
html-encoding-sniffer@4.0.0:
|
||||
dependencies:
|
||||
whatwg-encoding: 3.1.1
|
||||
@@ -9180,10 +9130,6 @@ snapshots:
|
||||
dependencies:
|
||||
brace-expansion: 2.0.1
|
||||
|
||||
minimatch@7.4.6:
|
||||
dependencies:
|
||||
brace-expansion: 2.0.1
|
||||
|
||||
minimatch@9.0.4:
|
||||
dependencies:
|
||||
brace-expansion: 2.0.1
|
||||
@@ -10805,6 +10751,4 @@ snapshots:
|
||||
|
||||
yocto-queue@1.0.0: {}
|
||||
|
||||
zod@3.23.6: {}
|
||||
|
||||
zod@3.23.8: {}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# Run migrations
|
||||
node ./db/migrate.cjs ./db/migrations/sqlite
|
||||
node ./db/migrations/$DB_DIALECT/migrate.cjs ./db/migrations/$DB_DIALECT
|
||||
|
||||
# Start Redis
|
||||
redis-server &
|
||||
|
||||
Reference in New Issue
Block a user