mend / renovate-ce-ee

Mend Renovate Documentation & Examples
https://www.mend.io/renovate/
Other
181 stars 62 forks source link

ERROR: Cannot apply DB migrations #71

Closed ilyalavrenov closed 5 years ago

ilyalavrenov commented 5 years ago

getting the following error after upgrading from renovate/pro:0.16.0-pre.2 to renovate/pro:0.16.2, looks like a syntax error in the DB connection string:

 INFO: Connected to DB
ERROR: Cannot apply DB migrations
       "err": {
         "name": "error",
         "length": 90,
         "severity": "ERROR",
         "code": "42601",
         "position": "38",
         "file": "scan.l",
         "line": "1127",
         "routine": "scanner_yyerror",
         "appliedMigrations": [],
         "message": "syntax error at or near \";\"",
         "stack": "error: syntax error at or near \";\"\n    at Connection.parseE (/usr/src/app/node_modules/pg/lib/connection.js:602:11)\n    at Connection.parseMessage (/usr/src/app/node_modules/pg/lib/connection.js:399:19)\n    at Socket.<anonymous> (/usr/src/app/node_modules/pg/lib/connection.js:121:22)\n    at Socket.emit (events.js:198:13)\n    at addChunk (_stream_readable.js:288:12)\n    at readableAddChunk (_stream_readable.js:269:11)\n    at Socket.Readable.push (_stream_readable.js:224:10)\n    at TCP.onStreamRead (internal/stream_base_commons.js:94:17)"
       },
       "message": "syntax error at or near \";\""

so far we've reverted back to renovate/pro:0.16.0-pre.2 which doesn't have the issue. the connection parameters are provided by the env vars PGHOST, PGUSER, PGPASSWORD, and PGDATABASE.

rarkins commented 5 years ago

I've attempted to reproduce this by first running 0.16.0-pre.2 and then bringing it down and bringing up 0.16.2, but it succeeded in migrating:

server_1  |  INFO: Applied DB migrations
server_1  | DEBUG: 
server_1  |        "migrations": [
server_1  |          {
server_1  |            "version": 5,
server_1  |            "action": "do",
server_1  |            "filename": "005.do.enqueue-fix.sql",
server_1  |            "name": "enqueue-fix",
server_1  |            "md5": "8b26023b4c34aac343341d1620d05a09"
server_1  |          }
server_1  |        ]

Anyway, the Renovate DB contains only ephemeral data so the best thing to do is to bring down the containers, delete your local DB data, then bring up 0.16.2 with a clean DB.

ilyalavrenov commented 5 years ago

seems this was our own doing. we were using a managed postgres DB on v9.6, upgrading to 10+ as specified in the docs solved the issue.