From 44930342a80fec860f1ca843a3d429e46267e030 Mon Sep 17 00:00:00 2001 From: anatawa12 Date: Sun, 19 Oct 2025 11:34:34 +0900 Subject: [PATCH] Revert typeorm patches (#16664) * chore: remove patches * chore: remove unnecessary 'DEFAULT NULL's * chore: add patches with .gitkeep --- package.json | 3 --- .../1760790899857-unnecessary-null-default.js | 26 +++++++++++++++++++ patches/.gitkeep | 0 patches/typeorm.patch | 17 ------------ pnpm-lock.yaml | 9 ++----- 5 files changed, 28 insertions(+), 27 deletions(-) create mode 100644 packages/backend/migration/1760790899857-unnecessary-null-default.js create mode 100644 patches/.gitkeep delete mode 100644 patches/typeorm.patch diff --git a/package.json b/package.json index 55286bc5a7..28441a7bea 100644 --- a/package.json +++ b/package.json @@ -85,9 +85,6 @@ "pnpm": { "overrides": { "@aiscript-dev/aiscript-languageserver": "-" - }, - "patchedDependencies": { - "typeorm": "patches/typeorm.patch" } } } diff --git a/packages/backend/migration/1760790899857-unnecessary-null-default.js b/packages/backend/migration/1760790899857-unnecessary-null-default.js new file mode 100644 index 0000000000..d34758315f --- /dev/null +++ b/packages/backend/migration/1760790899857-unnecessary-null-default.js @@ -0,0 +1,26 @@ +/* + * SPDX-FileCopyrightText: syuilo and misskey-project + * SPDX-License-Identifier: AGPL-3.0-only + */ + +export class UnnecessaryNullDefault1760790899857 { + name = 'UnnecessaryNullDefault1760790899857' + + /** + * @param {QueryRunner} queryRunner + */ + async up(queryRunner) { + await queryRunner.query(`ALTER TABLE "abuse_report_notification_recipient" ALTER COLUMN "userId" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "abuse_report_notification_recipient" ALTER COLUMN "systemWebhookId" DROP DEFAULT`); + await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "urlPreviewUserAgent" DROP DEFAULT`); + } + + /** + * @param {QueryRunner} queryRunner + */ + async down(queryRunner) { + await queryRunner.query(`ALTER TABLE "meta" ALTER COLUMN "urlPreviewUserAgent" SET DEFAULT NULL`); + await queryRunner.query(`ALTER TABLE "abuse_report_notification_recipient" ALTER COLUMN "systemWebhookId" SET DEFAULT NULL`); + await queryRunner.query(`ALTER TABLE "abuse_report_notification_recipient" ALTER COLUMN "userId" SET DEFAULT NULL`); + } +} diff --git a/patches/.gitkeep b/patches/.gitkeep new file mode 100644 index 0000000000..e69de29bb2 diff --git a/patches/typeorm.patch b/patches/typeorm.patch deleted file mode 100644 index 6b30cddb66..0000000000 --- a/patches/typeorm.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/driver/postgres/PostgresDriver.js b/driver/postgres/PostgresDriver.js -index e13b903c73b71113bb529552e59fb4ce0ca8af0c..50de6a60120ece7ebf49009eac588a5313343f39 100644 ---- a/driver/postgres/PostgresDriver.js -+++ b/driver/postgres/PostgresDriver.js -@@ -819,10 +819,10 @@ class PostgresDriver { - const tableColumnDefault = typeof tableColumn.default === "string" - ? JSON.parse(tableColumn.default.substring(1, tableColumn.default.length - 1)) - : tableColumn.default; -- return OrmUtils_1.OrmUtils.deepCompare(columnMetadata.default, tableColumnDefault); -+ return OrmUtils_1.OrmUtils.deepCompare(columnMetadata.default, tableColumnDefault ?? null); - } - const columnDefault = this.lowerDefaultValueIfNecessary(this.normalizeDefault(columnMetadata)); -- return columnDefault === tableColumn.default; -+ return columnDefault === tableColumn.default || columnDefault === undefined && tableColumn.default.toLowerCase() === 'null'; - } - /** - * Normalizes "isUnique" value of the column. diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3fc2f76c70..689250d4e2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -9,11 +9,6 @@ overrides: lodash: 4.17.21 '@aiscript-dev/aiscript-languageserver': '-' -patchedDependencies: - typeorm: - hash: b1141d7fd5ff7abdae28a93b2a634f595c7848518643c08d120698da1d2b4ebc - path: patches/typeorm.patch - importers: .: @@ -430,7 +425,7 @@ importers: version: 4.2.0 typeorm: specifier: 0.3.27 - version: 0.3.27(patch_hash=b1141d7fd5ff7abdae28a93b2a634f595c7848518643c08d120698da1d2b4ebc)(ioredis@5.8.0)(pg@8.16.3)(reflect-metadata@0.2.2) + version: 0.3.27(ioredis@5.8.0)(pg@8.16.3)(reflect-metadata@0.2.2) typescript: specifier: 5.9.3 version: 5.9.3 @@ -22133,7 +22128,7 @@ snapshots: typedarray@0.0.6: {} - typeorm@0.3.27(patch_hash=b1141d7fd5ff7abdae28a93b2a634f595c7848518643c08d120698da1d2b4ebc)(ioredis@5.8.0)(pg@8.16.3)(reflect-metadata@0.2.2): + typeorm@0.3.27(ioredis@5.8.0)(pg@8.16.3)(reflect-metadata@0.2.2): dependencies: '@sqltools/formatter': 1.2.5 ansis: 3.17.0