Misskey: db migration error from 11.27.0 to 11.27.1

Created on 7 Aug 2019  ·  4Comments  ·  Source: syuilo/misskey

💡 Summary

cant success run yarn migrate

🙂 Expected Behavior


Success

☹️ Actual Behavior

yarn run v1.17.3
$ ts-node ./node_modules/typeorm/cli.js migration:run
query: SELECT * FROM "information_schema"."tables" WHERE "table_schema" = current_schema() AND "table_name" = 'migrations'
query: SELECT * FROM "migrations" "migrations"
16 migrations are already loaded in the database.
17 migrations were found in the source code.
UsedUsername1563757595828 is the last executed migration. It was executed on Mon Jul 22 2019 01:06:35 GMT+0000 (Coordinated Universal Time).
1 migrations are new migrations that needs to be executed.
query: START TRANSACTION
query: CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')
query failed: CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')
error: { error: type "page_visibility_enum" already exists
    at Connection.parseE (/home/misskey/misskey/node_modules/pg/lib/connection.js:602:11)
    at Connection.parseMessage (/home/misskey/misskey/node_modules/pg/lib/connection.js:399:19)
    at Socket.<anonymous> (/home/misskey/misskey/node_modules/pg/lib/connection.js:121:22)
    at Socket.emit (events.js:193:13)
    at Socket.EventEmitter.emit (domain.js:481:20)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:276:11)
    at Socket.Readable.push (_stream_readable.js:231:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:154:17)
  name: 'error',
  length: 100,
  severity: 'ERROR',
  code: '42710',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'typecmds.c',
  line: '1139',
  routine: 'DefineEnum' }
query: ROLLBACK
Error during migration run:
{ QueryFailedError: type "page_visibility_enum" already exists
    at new QueryFailedError (/home/misskey/misskey/src/error/QueryFailedError.ts:9:9)
    at Query.callback (/home/misskey/misskey/src/driver/postgres/PostgresQueryRunner.ts:178:30)
    at Query.handleError (/home/misskey/misskey/node_modules/pg/lib/query.js:142:17)
    at Connection.connectedErrorMessageHandler (/home/misskey/misskey/node_modules/pg/lib/client.js:194:17)
    at Connection.emit (events.js:193:13)
    at Connection.EventEmitter.emit (domain.js:481:20)
    at Socket.<anonymous> (/home/misskey/misskey/node_modules/pg/lib/connection.js:126:12)
    at Socket.emit (events.js:193:13)
    at Socket.EventEmitter.emit (domain.js:481:20)
    at addChunk (_stream_readable.js:295:12)
  message: 'type "page_visibility_enum" already exists',
  name: 'QueryFailedError',
  length: 100,
  severity: 'ERROR',
  code: '42710',
  detail: undefined,
  hint: undefined,
  position: undefined,
  internalPosition: undefined,
  internalQuery: undefined,
  where: undefined,
  schema: undefined,
  table: undefined,
  column: undefined,
  dataType: undefined,
  constraint: undefined,
  file: 'typecmds.c',
  line: '1139',
  routine: 'DefineEnum',
  query:
   `CREATE TYPE "page_visibility_enum" AS ENUM('public', 'followers', 'specified')`,
  parameters: [] }
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

📌 Environment

Ubuntu 18.04

⚠️bug?

Most helpful comment

Try Execute
node built/tools/accept-migration Pages 1556348509290 to resolve this error.

All 4 comments

Try Execute
node built/tools/accept-migration Pages 1556348509290 to resolve this error.

So there are nothing needs to do with the db but just the script some how goes to execute?

It would be. these changes are already applied on your database, but it wasn't marked as processed on check table by some reasons (e.g created database with old method, typeorm sync, migrated from v10, and other accidents...), so only thing what you need is 'mark it as processed migration'.

Gotcha thx!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marek-lach picture marek-lach  ·  3Comments

2vg picture 2vg  ·  3Comments

ShinoharaTa picture ShinoharaTa  ·  3Comments

tosuke picture tosuke  ·  3Comments

ibrokemypie picture ibrokemypie  ·  3Comments