Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error During Migration Run to 12.111.x #8852

Closed
Lakr233 opened this issue Jun 20, 2022 · 9 comments · Fixed by #9753
Closed

Error During Migration Run to 12.111.x #8852

Lakr233 opened this issue Jun 20, 2022 · 9 comments · Fixed by #9753
Labels
🐛Bug Unexpected behavior docker Pull requests that update Docker code 🔥high priority

Comments

@Lakr233
Copy link

Lakr233 commented Jun 20, 2022

Was upgrading inside docker:

    image: misskey/misskey:12.110.1 -> latest (error)
    image: postgres:latest (boot success)
    image: redis:latest (boot success)

Failure during boot, I also tried 12.111.1 but no luck:

postgres_1  | 
postgres_1  | PostgreSQL Database directory appears to contain a database; Skipping 
initialization
postgres_1  | 
redis_1     | 1:C 20 Jun 2022 01:51:49.945 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
redis_1     | 1:C 20 Jun 2022 01:51:49.945 # Redis version=7.0.2, bits=64, commit=00000000, 
modified=0, pid=1, just started
redis_1     | 1:C 20 Jun 2022 01:51:49.945 # Configuration loaded
postgres_1  | 2022-06-20 01:51:50.914 UTC [1] LOG:  starting PostgreSQL 14.3 (Debian 
14.3-1.pgdg110+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 10.2.1-6) 10.2.1 20210110, 
64-bit
postgres_1  | 2022-06-20 01:51:50.919 UTC [1] LOG:  listening on IPv4 address "0.0.0.0", port 
5432
postgres_1  | 2022-06-20 01:51:50.919 UTC [1] LOG:  listening on IPv6 address "::", port 5432
redis_1     | 1:M 20 Jun 2022 01:51:49.945 * monotonic clock: POSIX clock_gettime
postgres_1  | 2022-06-20 01:51:50.924 UTC [1] LOG:  listening on Unix socket 
"/var/run/postgresql/.s.PGSQL.5432"
postgres_1  | 2022-06-20 01:51:50.937 UTC [26] LOG:  database system was shut down at 
2022-06-20 01:48:10 UTC
redis_1     | 1:M 20 Jun 2022 01:51:49.954 * Running mode=standalone, port=6379.
redis_1     | 1:M 20 Jun 2022 01:51:49.954 # Server initialized
redis_1     | 1:M 20 Jun 2022 01:51:49.957 * Loading RDB produced by version 7.0.2
redis_1     | 1:M 20 Jun 2022 01:51:49.958 * RDB age 219 seconds
redis_1     | 1:M 20 Jun 2022 01:51:49.958 * RDB memory usage when created 14.56 Mb
postgres_1  | 2022-06-20 01:51:50.968 UTC [1] LOG:  database system is ready to accept 
connections
redis_1     | 1:M 20 Jun 2022 01:51:50.437 * Done loading RDB, keys loaded: 11631, keys 
expired: 0.
redis_1     | 1:M 20 Jun 2022 01:51:50.437 * DB loaded from disk: 0.480 seconds
redis_1     | 1:M 20 Jun 2022 01:51:50.437 * Ready to accept connections
npc_1       | 2022/06/20 01:51:51.817 [I] [npc.go:231]  the version of client is 0.26.10, the 
core version of client is 0.26.0
misskey_1   | 
misskey_1   | > misskey@12.111.0 migrateandstart
misskey_1   | > npm run migrate && npm run start
misskey_1   | 
misskey_1   | 
misskey_1   | > misskey@12.111.0 migrate
misskey_1   | > cd packages/backend && npx typeorm migration:run -d ormconfig.js
misskey_1   | 
misskey_1   | query: SELECT * FROM current_schema()
misskey_1   | query: SHOW server_version;
misskey_1   | query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 
'public' AND "table_name" = 'migrations'
misskey_1   | query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 
'public' AND "table_name" = 'typeorm_metadata'
misskey_1   | query: SELECT * FROM "migrations" "migrations" ORDER BY "id" DESC
misskey_1   | 140 migrations are already loaded in the database.
misskey_1   | 142 migrations were found in the source code.
misskey_1   | webhook21648816172177 is the last executed migration. It was executed on Fri Apr 
01 2022 12:29:32 GMT+0000 (Coordinated Universal Time).
misskey_1   | 2 migrations are new migrations must be executed.
misskey_1   | query: START TRANSACTION
misskey_1   | query: ALTER INDEX "public"."IDX_seoignmeoprigmkpodgrjmkpormg" RENAME TO 
"IDX_c8cc87bd0f2f4487d17c651fbf"
misskey_1   | query: DROP INDEX "public"."IDX_note_on_channelId_and_id_desc"
misskey_1   | query: ALTER TABLE "user" ALTER COLUMN "followersUri" DROP DEFAULT
misskey_1   | query: ALTER TABLE "access_token" ALTER COLUMN "session" DROP DEFAULT
misskey_1   | query: ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT
misskey_1   | query: ALTER TABLE "access_token" ALTER COLUMN "name" DROP DEFAULT
misskey_1   | query: ALTER TABLE "access_token" ALTER COLUMN "description" DROP DEFAULT
misskey_1   | query: ALTER TABLE "access_token" ALTER COLUMN "iconUrl" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "softwareName" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "softwareVersion" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "name" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "description" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "maintainerName" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "maintainerEmail" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "iconUrl" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "faviconUrl" DROP DEFAULT
misskey_1   | query: ALTER TABLE "instance" ALTER COLUMN "themeColor" DROP DEFAULT
misskey_1   | query: ALTER TABLE "clip" ALTER COLUMN "description" DROP DEFAULT
misskey_1   | query: ALTER TABLE "note" ALTER COLUMN "channelId" DROP DEFAULT
misskey_1   | query: ALTER TABLE "abuse_user_report" ALTER COLUMN "comment" DROP DEFAULT
misskey_1   | query: CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")
misskey_1   | query: CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId")
misskey_1   | query: CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" 
("targetUserId")
misskey_1   | query: DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN (SELECT "id" 
FROM "user")
misskey_1   | query: ALTER TABLE "poll" ADD CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b" UNIQUE 
("noteId")
misskey_1   | query: ALTER TABLE "user_keypair" ADD CONSTRAINT 
"UQ_f4853eb41ab722fe05f81cedeb6" UNIQUE ("userId")
misskey_1   | query: ALTER TABLE "user_profile" ADD CONSTRAINT 
"UQ_51cb79b5555effaf7d69ba1cff9" UNIQUE ("userId")
misskey_1   | query: ALTER TABLE "user_publickey" ADD CONSTRAINT 
"UQ_10c146e4b39b443ede016f6736d" UNIQUE ("userId")
misskey_1   | query: ALTER TABLE "promo_note" ADD CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c" 
UNIQUE ("noteId")
misskey_1   | query: ALTER TABLE "page" RENAME CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" TO 
"FK_a9ca79ad939bf06066b81c9d3aa"
misskey_1   | query: ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 
'pollEnded' AFTER 'pollVote'
postgres_1  | 2022-06-20 01:51:54.984 UTC [33] ERROR:  relation 
"IDX_a9021cc2e1feb5f72d3db6e9f5" already exists
postgres_1  | 2022-06-20 01:51:54.984 UTC [33] STATEMENT:  CREATE INDEX 
"IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")
misskey_1   | query failed: CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON 
"abuse_user_report" ("targetUserId")
misskey_1   | error: error: relation "IDX_a9021cc2e1feb5f72d3db6e9f5" already exists
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 112,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '42P07',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'index.c',
misskey_1   |   line: '869',
misskey_1   |   routine: 'index_create'
misskey_1   | }
misskey_1   | Migration "foreignKeyReports1651224615271" failed, error: relation 
"IDX_a9021cc2e1feb5f72d3db6e9f5" already exists
misskey_1   | query: ROLLBACK
postgres_1  | 2022-06-20 01:51:54.990 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:54.990 UTC [33] STATEMENT:  DELETE FROM "abuse_user_report" 
WHERE "targetUserId" NOT IN (SELECT "id" FROM "user")
postgres_1  | 2022-06-20 01:51:54.990 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:54.990 UTC [33] STATEMENT:  ALTER TABLE "poll" ADD CONSTRAINT 
"UQ_da851e06d0dfe2ef397d8b1bf1b" UNIQUE ("noteId")
misskey_1   | query failed: DELETE FROM "abuse_user_report" WHERE "targetUserId" NOT IN 
(SELECT "id" FROM "user")
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
postgres_1  | 2022-06-20 01:51:54.993 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:54.993 UTC [33] STATEMENT:  ALTER TABLE "user_keypair" ADD 
CONSTRAINT "UQ_f4853eb41ab722fe05f81cedeb6" UNIQUE ("userId")
misskey_1   | query failed: ALTER TABLE "poll" ADD CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b" 
UNIQUE ("noteId")
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
misskey_1   | query failed: ALTER TABLE "user_keypair" ADD CONSTRAINT 
"UQ_f4853eb41ab722fe05f81cedeb6" UNIQUE ("userId")
postgres_1  | 2022-06-20 01:51:54.996 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:54.996 UTC [33] STATEMENT:  ALTER TABLE "user_profile" ADD 
CONSTRAINT "UQ_51cb79b5555effaf7d69ba1cff9" UNIQUE ("userId")
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
misskey_1   | query failed: ALTER TABLE "user_profile" ADD CONSTRAINT 
"UQ_51cb79b5555effaf7d69ba1cff9" UNIQUE ("userId")
postgres_1  | 2022-06-20 01:51:54.998 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:54.998 UTC [33] STATEMENT:  ALTER TABLE "user_publickey" ADD 
CONSTRAINT "UQ_10c146e4b39b443ede016f6736d" UNIQUE ("userId")
postgres_1  | 2022-06-20 01:51:54.999 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:54.999 UTC [33] STATEMENT:  ALTER TABLE "promo_note" ADD 
CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c" UNIQUE ("noteId")
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
postgres_1  | 2022-06-20 01:51:55.001 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:55.001 UTC [33] STATEMENT:  ALTER TABLE "page" RENAME 
CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" TO "FK_a9ca79ad939bf06066b81c9d3aa"
misskey_1   | query failed: ALTER TABLE "user_publickey" ADD CONSTRAINT 
"UQ_10c146e4b39b443ede016f6736d" UNIQUE ("userId")
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
postgres_1  | 2022-06-20 01:51:55.003 UTC [33] ERROR:  current transaction is aborted, 
commands ignored until end of transaction block
postgres_1  | 2022-06-20 01:51:55.003 UTC [33] STATEMENT:  ALTER TYPE 
"public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'pollEnded' AFTER 'pollVote'
misskey_1   | query failed: ALTER TABLE "promo_note" ADD CONSTRAINT 
"UQ_e263909ca4fe5d57f8d4230dd5c" UNIQUE ("noteId")
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
misskey_1   | query failed: ALTER TABLE "page" RENAME CONSTRAINT 
"FK_3126dd7c502c9e4d7597ef7ef10" TO "FK_a9ca79ad939bf06066b81c9d3aa"
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
misskey_1   | query failed: ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" 
ADD VALUE 'pollEnded' AFTER 'pollVote'
misskey_1   | error: error: current transaction is aborted, commands ignored until end of 
transaction block
misskey_1   |     at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |     at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |     at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |     at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |     at Socket.emit (node:events:527:28)
misskey_1   |     at addChunk (node:internal/streams/readable:324:12)
misskey_1   |     at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |     at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |     at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |   length: 144,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '25P02',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'postgres.c',
misskey_1   |   line: '1076',
misskey_1   |   routine: 'exec_simple_query'
misskey_1   | }
misskey_1   | Error during migration run:
misskey_1   | QueryFailedError: relation "IDX_a9021cc2e1feb5f72d3db6e9f5" already exists
misskey_1   |     at PostgresQueryRunner.query 
(/misskey/packages/backend/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
misskey_1   |     at process.processTicksAndRejections 
(node:internal/process/task_queues:95:5)
misskey_1   |     at async Promise.all (index 22)
misskey_1   |     at async foreignKeyReports1651224615271.up 
(file:///misskey/packages/backend/migration/1651224615271-foreign-key.js:5:9)
misskey_1   |     at async MigrationExecutor.executePendingMigrations 
(/misskey/packages/backend/node_modules/typeorm/migration/MigrationExecutor.js:178:17)
misskey_1   |     at async DataSource.runMigrations 
(/misskey/packages/backend/node_modules/typeorm/data-source/DataSource.js:248:35)
misskey_1   |     at async Object.handler 
(/misskey/packages/backend/node_modules/typeorm/commands/MigrationRunCommand.js:60:13) {
misskey_1   |   query: 'CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" 
("targetUserId")',
misskey_1   |   parameters: undefined,
misskey_1   |   driverError: error: relation "IDX_a9021cc2e1feb5f72d3db6e9f5" already exists
misskey_1   |       at Parser.parseErrorMessage 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
misskey_1   |       at Parser.handlePacket 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
misskey_1   |       at Parser.parse 
(/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
misskey_1   |       at Socket.<anonymous> 
(/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
misskey_1   |       at Socket.emit (node:events:527:28)
misskey_1   |       at addChunk (node:internal/streams/readable:324:12)
misskey_1   |       at readableAddChunk (node:internal/streams/readable:297:9)
misskey_1   |       at Readable.push (node:internal/streams/readable:234:10)
misskey_1   |       at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
misskey_1   |     length: 112,
misskey_1   |     severity: 'ERROR',
misskey_1   |     code: '42P07',
misskey_1   |     detail: undefined,
misskey_1   |     hint: undefined,
misskey_1   |     position: undefined,
misskey_1   |     internalPosition: undefined,
misskey_1   |     internalQuery: undefined,
misskey_1   |     where: undefined,
misskey_1   |     schema: undefined,
misskey_1   |     table: undefined,
misskey_1   |     column: undefined,
misskey_1   |     dataType: undefined,
misskey_1   |     constraint: undefined,
misskey_1   |     file: 'index.c',
misskey_1   |     line: '869',
misskey_1   |     routine: 'index_create'
misskey_1   |   },
misskey_1   |   length: 112,
misskey_1   |   severity: 'ERROR',
misskey_1   |   code: '42P07',
misskey_1   |   detail: undefined,
misskey_1   |   hint: undefined,
misskey_1   |   position: undefined,
misskey_1   |   internalPosition: undefined,
misskey_1   |   internalQuery: undefined,
misskey_1   |   where: undefined,
misskey_1   |   schema: undefined,
misskey_1   |   table: undefined,
misskey_1   |   column: undefined,
misskey_1   |   dataType: undefined,
misskey_1   |   constraint: undefined,
misskey_1   |   file: 'index.c',
misskey_1   |   line: '869',
misskey_1   |   routine: 'index_create'
misskey_1   | }
misskey_1   | npm notice 
misskey_1   | npm notice New minor version of npm available! 8.6.0 -> 8.12.2
misskey_1   | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.12.2>
misskey_1   | npm notice Run `npm install -g npm@8.12.2` to update!
misskey_1   | npm notice 
misskey_1   | npm notice 
misskey_1   | npm notice New minor version of npm available! 8.6.0 -> 8.12.2
misskey_1   | npm notice Changelog: <https://github.com/npm/cli/releases/tag/v8.12.2>
misskey_1   | npm notice Run `npm install -g npm@8.12.2` to update!
misskey_1   | npm notice 

It will work after downgrading to 12.110.x.

@Lakr233 Lakr233 added the ⚠️bug? This might be a bug label Jun 20, 2022
@syuilo syuilo added 🐛Bug Unexpected behavior and removed ⚠️bug? This might be a bug labels Jun 20, 2022
@tamaina
Copy link
Contributor

tamaina commented Jun 20, 2022

@Johann150 Johann150 added the docker Pull requests that update Docker code label Jun 20, 2022
@Lakr233
Copy link
Author

Lakr233 commented Jun 22, 2022

I've heard one of my friend sharing his working solution on this, I think I'll just wait for another release. Ping me when ready, thanks.

$ diff ../pp/misskey/packages/backend/migration/1651224615271-foreign-key.js  ../pp/misskey/packages/backend/migration/1651224615271-foreign-key.js.bk
31c31
<             queryRunner.query(`CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f6" ON "abuse_user_report" ("targetUserId")`),
---
>             queryRunner.query(`CREATE INDEX "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")`),
34c34
<                 queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f6f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
---
>                 queryRunner.query(`ALTER TABLE "abuse_user_report" ADD CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f" FOREIGN KEY ("targetUserId") REFERENCES "user"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
76c76
<             queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f6f"`),
---
>             queryRunner.query(`ALTER TABLE "abuse_user_report" DROP CONSTRAINT "FK_a9021cc2e1feb5f72d3db6e9f5f"`),
78c78
<             queryRunner.query(`DROP INDEX "public"."IDX_a9021cc2e1feb5f72d3db6e9f6"`),
---
>             queryRunner.query(`DROP INDEX "public"."IDX_a9021cc2e1feb5f72d3db6e9f5"`),

@syuilo
Copy link
Member

syuilo commented Jul 1, 2022

@tamaina
Copy link
Contributor

tamaina commented Jul 1, 2022

クエリエラーが発生した時点でマイグレーションのトランザクションが使えなくなるので
catchでもみ消しても、Node.js 側にエラーが挙がって来なくなるだけで結局動かない。
だった気がするのだわ。

#8896 (comment)

@syuilo
Copy link
Member

syuilo commented Jul 1, 2022

じゃあインデックスの存在確認してからCREATEするようにすればいいか

syuilo added a commit that referenced this issue Jul 16, 2022
@syuilo
Copy link
Member

syuilo commented Jul 16, 2022

とりあえずコメントアウト

syuilo added a commit that referenced this issue Jul 16, 2022
@kazukyakayashi
Copy link

Hmm i try update Misskey this mornig, but I always get an error during migration

> misskey@12.117.0 gulp
> gulp build

[07:07:14] Using gulpfile ~/misskey/gulpfile.js
[07:07:14] Starting 'build'...
[07:07:14] Starting 'copy:client:locales'...
[07:07:14] Starting 'copy:backend:views'...
[07:07:14] Starting 'build:backend:script'...
[07:07:14] Starting 'build:backend:style'...
[07:07:14] Starting 'copy:client:fonts'...
[07:07:14] Starting 'copy:client:fontawesome'...
[07:07:14] Finished 'copy:client:locales' after 23 ms
[07:07:15] Finished 'build:backend:script' after 468 ms
[07:07:15] Finished 'build:backend:style' after 468 ms
[07:07:15] Finished 'copy:backend:views' after 520 ms
[07:07:15] Finished 'copy:client:fonts' after 560 ms
[07:07:16] Finished 'copy:client:fontawesome' after 1.71 s
[07:07:16] Finished 'build' after 1.72 s
Done in 48.19s.
<13>Jul 18 07:07:16 misskey_update.sh: [INFO] Migrate
yarn run v1.22.19
$ cd packages/backend && npx typeorm migration:run -d ormconfig.js
query: SELECT * FROM current_schema()
query: SHOW server_version;
query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = 'public' AND "table_name" = 'migrations'
query: SELECT * FROM "migrations" "migrations" ORDER BY "id" DESC
140 migrations are already loaded in the database.
154 migrations were found in the source code.
webhook21648816172177 is the last executed migration. It was executed on Fri Apr 01 2022 14:29:32 GMT+0200 (Central European Summer Time).
14 migrations are new migrations must be executed.
query: START TRANSACTION
query: ALTER INDEX "public"."IDX_seoignmeoprigmkpodgrjmkpormg" RENAME TO "IDX_c8cc87bd0f2f4487d17c651fbf"
query: DROP INDEX "public"."IDX_note_on_channelId_and_id_desc"
query: ALTER TABLE "user" ALTER COLUMN "followersUri" DROP DEFAULT
query: ALTER TABLE "access_token" ALTER COLUMN "session" DROP DEFAULT
query: ALTER TABLE "access_token" ALTER COLUMN "appId" DROP DEFAULT
query: ALTER TABLE "access_token" ALTER COLUMN "name" DROP DEFAULT
query: ALTER TABLE "access_token" ALTER COLUMN "description" DROP DEFAULT
query: ALTER TABLE "access_token" ALTER COLUMN "iconUrl" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "softwareName" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "softwareVersion" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "name" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "description" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "maintainerName" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "maintainerEmail" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "iconUrl" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "faviconUrl" DROP DEFAULT
query: ALTER TABLE "instance" ALTER COLUMN "themeColor" DROP DEFAULT
query: ALTER TABLE "clip" ALTER COLUMN "description" DROP DEFAULT
query: ALTER TABLE "note" ALTER COLUMN "channelId" DROP DEFAULT
query: ALTER TABLE "abuse_user_report" ALTER COLUMN "comment" DROP DEFAULT
query: CREATE INDEX "IDX_315c779174fe8247ab324f036e" ON "drive_file" ("isLink")
query: CREATE INDEX "IDX_f22169eb10657bded6d875ac8f" ON "note" ("channelId")
query: ALTER TABLE "poll" ADD CONSTRAINT "UQ_da851e06d0dfe2ef397d8b1bf1b" UNIQUE ("noteId")
query: ALTER TABLE "user_keypair" ADD CONSTRAINT "UQ_f4853eb41ab722fe05f81cedeb6" UNIQUE ("userId")
query: ALTER TABLE "user_profile" ADD CONSTRAINT "UQ_51cb79b5555effaf7d69ba1cff9" UNIQUE ("userId")
query: ALTER TABLE "user_publickey" ADD CONSTRAINT "UQ_10c146e4b39b443ede016f6736d" UNIQUE ("userId")
query: ALTER TABLE "promo_note" ADD CONSTRAINT "UQ_e263909ca4fe5d57f8d4230dd5c" UNIQUE ("noteId")
query: ALTER TABLE "page" RENAME CONSTRAINT "FK_3126dd7c502c9e4d7597ef7ef10" TO "FK_a9ca79ad939bf06066b81c9d3aa"
query: ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'pollEnded' AFTER 'pollVote'
query failed: ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'pollEnded' AFTER 'pollVote'
error: error: ALTER TYPE ... ADD cannot run inside a transaction block
    at Parser.parseErrorMessage (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
    at Parser.handlePacket (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
    at Parser.parse (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
    at Socket.<anonymous> (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
    at Socket.emit (node:events:527:28)
    at addChunk (node:internal/streams/readable:315:12)
    at readableAddChunk (node:internal/streams/readable:289:9)
    at Socket.Readable.push (node:internal/streams/readable:228:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
  length: 125,
  severity: 'ERROR',
  code: '25001',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'xact.c',
  line: '3230',
  routine: 'PreventInTransactionBlock'
}
Migration "foreignKeyReports1651224615271" failed, error: ALTER TYPE ... ADD cannot run inside a transaction block
query: ROLLBACK
Error during migration run:
QueryFailedError: ALTER TYPE ... ADD cannot run inside a transaction block
    at PostgresQueryRunner.query (/home/misskey/misskey/packages/backend/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 28)
    at async foreignKeyReports1651224615271.up (file:///home/misskey/misskey/packages/backend/migration/1651224615271-foreign-key.js:5:9)
    at async MigrationExecutor.executePendingMigrations (/home/misskey/misskey/packages/backend/node_modules/typeorm/migration/MigrationExecutor.js:178:17)
    at async DataSource.runMigrations (/home/misskey/misskey/packages/backend/node_modules/typeorm/data-source/DataSource.js:248:35)
    at async Object.handler (/home/misskey/misskey/packages/backend/node_modules/typeorm/commands/MigrationRunCommand.js:60:13) {
  query: `ALTER TYPE "public"."user_profile_mutingnotificationtypes_enum" ADD VALUE 'pollEnded' AFTER 'pollVote'`,
  parameters: undefined,
  driverError: error: ALTER TYPE ... ADD cannot run inside a transaction block
      at Parser.parseErrorMessage (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
      at Parser.handlePacket (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
      at Parser.parse (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
      at Socket.<anonymous> (/home/misskey/misskey/packages/backend/node_modules/pg-protocol/dist/index.js:11:42)
      at Socket.emit (node:events:527:28)
      at addChunk (node:internal/streams/readable:315:12)
      at readableAddChunk (node:internal/streams/readable:289:9)
      at Socket.Readable.push (node:internal/streams/readable:228:10)
      at TCP.onStreamRead (node:internal/stream_base_commons:190:23) {
    length: 125,
    severity: 'ERROR',
    code: '25001',
    detail: undefined,
    hint: undefined,
    position: undefined,
    internalPosition: undefined,
    internalQuery: undefined,
    where: undefined,
    schema: undefined,
    table: undefined,
    column: undefined,
    dataType: undefined,
    constraint: undefined,
    file: 'xact.c',
    line: '3230',
    routine: 'PreventInTransactionBlock'
  },
  length: 125,
  severity: 'ERROR',
  code: '25001',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'xact.c',
  line: '3230',
  routine: 'PreventInTransactionBlock'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@Lakr233
Copy link
Author

Lakr233 commented Aug 24, 2022

Able to boot v12.118.1, updated.

@atsu1125
Copy link
Contributor

とりあえずコメントアウト

この影響でこれ以降に作成したインスタンスで
通報ページが参照できなくなっているインスタンスがある #9183
IF NOT EXISTSを追加すれば重複エラーは回避できるようになるので

CREATE INDEX IF NOT EXISTS "IDX_a9021cc2e1feb5f72d3db6e9f5" ON "abuse_user_report" ("targetUserId")

このように変更するべきではあるが
コメントアウト以降にすでにマイグレーションが完走してしまってるインスタンスも多数なので
別途これに加えて、コメントアウトされた通報の外部キー制約を加えたマイグレーションファイルを新規作成するのが一番よさそう。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛Bug Unexpected behavior docker Pull requests that update Docker code 🔥high priority
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants