diff --git a/Dockerfile b/Dockerfile index 4b9229bdc..2c4afb4fe 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/package.json b/package.json index 7b0356bfd..6fbc5cd25 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/packages/db/mysql.config.ts b/packages/db/configs/mysql.config.ts.ts similarity index 95% rename from packages/db/mysql.config.ts rename to packages/db/configs/mysql.config.ts.ts index 7ab40a3e5..b3669df13 100644 --- a/packages/db/mysql.config.ts +++ b/packages/db/configs/mysql.config.ts.ts @@ -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!, diff --git a/packages/db/sqlite.config.ts b/packages/db/configs/sqlite.config.ts similarity index 90% rename from packages/db/sqlite.config.ts rename to packages/db/configs/sqlite.config.ts index 689ea5312..919cbfc0b 100644 --- a/packages/db/sqlite.config.ts +++ b/packages/db/configs/sqlite.config.ts @@ -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; diff --git a/packages/db/driver.ts b/packages/db/driver.ts index 91c9085d7..f705b91ac 100644 --- a/packages/db/driver.ts +++ b/packages/db/driver.ts @@ -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, diff --git a/packages/db/migrations/mysql/0000_hot_mandrill.sql b/packages/db/migrations/mysql/0000_harsh_photon.sql similarity index 80% rename from packages/db/migrations/mysql/0000_hot_mandrill.sql rename to packages/db/migrations/mysql/0000_harsh_photon.sql index 699c102e5..0aa47aca5 100644 --- a/packages/db/migrations/mysql/0000_hot_mandrill.sql +++ b/packages/db/migrations/mysql/0000_harsh_photon.sql @@ -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; \ No newline at end of file +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`); \ No newline at end of file diff --git a/packages/db/migrations/mysql/0001_fluffy_overlord.sql b/packages/db/migrations/mysql/0001_fluffy_overlord.sql deleted file mode 100644 index d9ac14b20..000000000 --- a/packages/db/migrations/mysql/0001_fluffy_overlord.sql +++ /dev/null @@ -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; \ No newline at end of file diff --git a/packages/db/migrations/mysql/meta/0000_snapshot.json b/packages/db/migrations/mysql/meta/0000_snapshot.json index 293d2f12a..fc8577328 100644 --- a/packages/db/migrations/mysql/meta/0000_snapshot.json +++ b/packages/db/migrations/mysql/meta/0000_snapshot.json @@ -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": {}, diff --git a/packages/db/migrations/mysql/meta/0001_snapshot.json b/packages/db/migrations/mysql/meta/0001_snapshot.json deleted file mode 100644 index e9a4b6506..000000000 --- a/packages/db/migrations/mysql/meta/0001_snapshot.json +++ /dev/null @@ -1,1150 +0,0 @@ -{ - "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 3d57e7771..72ae1f1b7 100644 --- a/packages/db/migrations/mysql/meta/_journal.json +++ b/packages/db/migrations/mysql/meta/_journal.json @@ -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 } ] diff --git a/packages/db/migrations/mysql/migrate.ts b/packages/db/migrations/mysql/migrate.ts new file mode 100644 index 000000000..fd67b7f70 --- /dev/null +++ b/packages/db/migrations/mysql/migrate.ts @@ -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); + }); diff --git a/packages/db/migrations/sqlite/0000_premium_forgotten_one.sql b/packages/db/migrations/sqlite/0000_talented_ben_parker.sql similarity index 92% rename from packages/db/migrations/sqlite/0000_premium_forgotten_one.sql rename to packages/db/migrations/sqlite/0000_talented_ben_parker.sql index 9f9c3f451..247f822d7 100644 --- a/packages/db/migrations/sqlite/0000_premium_forgotten_one.sql +++ b/packages/db/migrations/sqlite/0000_talented_ben_parker.sql @@ -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, diff --git a/packages/db/migrations/sqlite/0001_unusual_rage.sql b/packages/db/migrations/sqlite/0001_unusual_rage.sql deleted file mode 100644 index 2525f98cd..000000000 --- a/packages/db/migrations/sqlite/0001_unusual_rage.sql +++ /dev/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 -); diff --git a/packages/db/migrations/sqlite/meta/0000_snapshot.json b/packages/db/migrations/sqlite/meta/0000_snapshot.json index 580bc6a9e..fd193e02f 100644 --- a/packages/db/migrations/sqlite/meta/0000_snapshot.json +++ b/packages/db/migrations/sqlite/meta/0000_snapshot.json @@ -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": { diff --git a/packages/db/migrations/sqlite/meta/0001_snapshot.json b/packages/db/migrations/sqlite/meta/0001_snapshot.json deleted file mode 100644 index 8a7cb7a93..000000000 --- a/packages/db/migrations/sqlite/meta/0001_snapshot.json +++ /dev/null @@ -1,1097 +0,0 @@ -{ - "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 de71b6850..8b44adc89 100644 --- a/packages/db/migrations/sqlite/meta/_journal.json +++ b/packages/db/migrations/sqlite/meta/_journal.json @@ -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 } ] diff --git a/packages/db/migrate.ts b/packages/db/migrations/sqlite/migrate.ts similarity index 81% rename from packages/db/migrate.ts rename to packages/db/migrations/sqlite/migrate.ts index 443a55878..abef5ea9d 100644 --- a/packages/db/migrate.ts +++ b/packages/db/migrations/sqlite/migrate.ts @@ -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:", "")); diff --git a/packages/db/package.json b/packages/db/package.json index 70d676cc3..67a3baf67 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -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", diff --git a/packages/db/schema/mysql.ts b/packages/db/schema/mysql.ts index 132a54767..3af3111fc 100644 --- a/packages/db/schema/mysql.ts +++ b/packages/db/schema/mysql.ts @@ -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().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().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().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().notNull(), + permission: varchar("permission", { length: 128 }) + .$type() + .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().notNull(), + permission: varchar("permission", { length: 128 }) + .$type() + .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().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().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(), }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 418d83543..5ba0b4268 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -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: {} diff --git a/scripts/run.sh b/scripts/run.sh index 06471d148..bc1e428bb 100644 --- a/scripts/run.sh +++ b/scripts/run.sh @@ -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 &