mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 04:03:49 +01:00
docs: 📝 foundkey patch (thanks volpeon!)
ref: https://is-a.wyvern.rip/notes/9hac2nd98s
This commit is contained in:
parent
e405a18fad
commit
a2e845ce95
42
docs/fk.patch
Normal file
42
docs/fk.patch
Normal file
@ -0,0 +1,42 @@
|
||||
diff --git a/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js b/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js
|
||||
index 42d79b5b5..057d3f9e3 100644
|
||||
--- a/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js
|
||||
+++ b/packages/backend/migration/1661376843000-remove-mentioned-remote-users-column.js
|
||||
@@ -6,7 +6,22 @@ export class removeMentionedRemoteUsersColumn1661376843000 {
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
- await queryRunner.query(`ALTER TABLE "note" ADD "mentionedRemoteUsers" TEXT NOT NULL DEFAULT '[]'::text`);
|
||||
- await queryRunner.query(`UPDATE "note" SET "mentionedRemoteUsers" = (SELECT COALESCE(json_agg(row_to_json("data"))::text, '[]') FROM (SELECT "url", "uri", "username", "host" FROM "user" JOIN "user_profile" ON "user"."id" = "user_profile". "userId" WHERE "user"."host" IS NOT NULL AND "user"."id" = ANY("note"."mentions")) AS "data")`);
|
||||
+ await queryRunner.query(`
|
||||
+ CREATE TEMP TABLE IF NOT EXISTS "temp_mentions" AS
|
||||
+ SELECT "id", "url", "uri", "username", "host"
|
||||
+ FROM "user"
|
||||
+ JOIN "user_profile" ON "user"."id" = "user_profile"."userId" WHERE "user"."host" IS NOT NULL
|
||||
+ `);
|
||||
+
|
||||
+ await queryRunner.query(`
|
||||
+ CREATE UNIQUE INDEX "temp_mentions_id" ON "temp_mentions"("id")
|
||||
+ `);
|
||||
+
|
||||
+ await queryRunner.query(`
|
||||
+ UPDATE "note" SET "mentionedRemoteUsers" = (
|
||||
+ SELECT COALESCE(json_agg(row_to_json("data")::jsonb - "id")::text, '[]') FROM "temp_mentions" AS "data"
|
||||
+ WHERE "data"."id" = ANY("note"."mentions")
|
||||
+ )
|
||||
+ `);
|
||||
}
|
||||
}
|
||||
diff --git a/packages/backend/migration/1663399074403-resize-comments-drive-file.js b/packages/backend/migration/1663399074403-resize-comments-drive-file.js
|
||||
index a037f1655..0873aec9b 100644
|
||||
--- a/packages/backend/migration/1663399074403-resize-comments-drive-file.js
|
||||
+++ b/packages/backend/migration/1663399074403-resize-comments-drive-file.js
|
||||
@@ -9,6 +9,6 @@ export class resizeCommentsDriveFile1663399074403 {
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
- await queryRunner.query(`ALTER TABLE "drive_file" ALTER COLUMN "comment" TYPE character varying(512)`);
|
||||
- }
|
||||
+ console.log('This migration cannot be reverted, skipping...');
|
||||
+ }
|
||||
}
|
@ -82,7 +82,8 @@ NODE_ENV=production pnpm run migrate
|
||||
|
||||
```sh
|
||||
cd packages/backend
|
||||
sed -i '12s/^/\/\//' ./migration/1663399074403-resize-comments-drive-file.js
|
||||
wget -O fk.patch https://codeberg.org/calckey/calckey/raw/branch/develop/docs/fk.patch
|
||||
git apply fk.patch
|
||||
|
||||
LINE_NUM="$(npx typeorm migration:show -d ormconfig.js | grep -n uniformThemecolor1652859567549 | cut -d ':' -f 1)"
|
||||
NUM_MIGRATIONS="$(npx typeorm migration:show -d ormconfig.js | tail -n+"$LINE_NUM" | grep '\[X\]' | wc -l)"
|
||||
|
Loading…
Reference in New Issue
Block a user