12.119.0 migrate database failed
💡 Summary
I upgrade misskey from 12.110.1 to 12.119.0, but database migrate failed
🥰 Expected Behavior
database migrate working
🤬 Actual Behavior
here is log
make misskey-stop
make[1]: Entering directory '/work/misskey'
docker service scale main_misskey_core=0
main_misskey_core scaled to 0
overall progress: 0 out of 0 tasks
verify: Waiting 5 seconds to verify that tasks are stable...
verify: Service converged
make[1]: Leaving directory '/work/misskey'
docker run --rm -ti \
-v main_misskey_conf:/misskey/.config/ \
-v /work/data/misskey-files:/misskey/files:rslave \
--net main_default \
misskey/misskey:12.119.0@sha256:a7beecb59b5089068463ca3847ac34dcb8445108da75ed8f56822f670053aa31 \
npm run migrate
> [email protected] migrate
> cd packages/backend && npx typeorm migration:run -d ormconfig.js
query: SELECT * FROM current_schema()
query: SELECT 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 12:29:32 GMT+0000 (Coordinated Universal 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 (/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
at Parser.handlePacket (/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/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: '3213',
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 (/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:///misskey/packages/backend/migration/1651224615271-foreign-key.js:5:9)
at async MigrationExecutor.executePendingMigrations (/misskey/packages/backend/node_modules/typeorm/migration/MigrationExecutor.js:184:17)
at async DataSource.runMigrations (/misskey/packages/backend/node_modules/typeorm/data-source/DataSource.js:249:35)
at async Object.handler (/misskey/packages/backend/node_modules/typeorm/commands/MigrationRunCommand.js:68: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 (/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:287:98)
at Parser.handlePacket (/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:126:29)
at Parser.parse (/misskey/packages/backend/node_modules/pg-protocol/dist/parser.js:39:38)
at Socket.<anonymous> (/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: '3213',
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',
[a.log](https://github.com/misskey-dev/misskey/files/9583892/a.log)
line: '3213',
routine: 'PreventInTransactionBlock'
}
npm notice
npm notice New minor version of npm available! 8.11.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g [email protected] to update!
npm notice
📝 Steps to Reproduce
📌 Environment
Misskey version: 12.110.1 Your OS: debian 10 Your browser: none
Same here
Misskey version: 12.110.1 Your OS: Debian 10 Yarn: 1.22.19 Node: 16.15.0
This may be due to incompatible database versions. Debian 10 uses PostgreSQL version 11.x as far as I know, but PostgreSQL 12.x/13.x is required:
https://misskey-hub.net/en/docs/install/manual.html
I have PostgreSQL v13 and it doesn't work.
same problem
Re install PostgreSQL. It will be HALP you. apt-get remove --purge postgresql*