My version of HedgeDoc is: 1.8.2
, 1.7.2
and 1.6.0
, plus CodiMD 1.6.0
.
What I expected to happen:
After upgrading from hackmdio/hackmd:1.2.0
to quay.io/hedgedoc/hedgedoc:1.8.2
the application runs.
$ diff docker-compose.hackmd.yml docker-compose.yml | grep image
- image: hackmdio/hackmd:1.2.0
+ image: quay.io/hedgedoc/hedgedoc:1.8.2
What actually happened:
Instead of booting up, a migration fails and startup is interrupted:
With 1.8.2
:
2021-06-30T18:49:49.285Z info: == 20180306150303-fix-enum: migrating =======
2021-06-30T18:49:49.291Z error: type "enum_Notes_permission" already exists
2021-06-30T18:49:49.291Z error: Database migration failed. Exiting…
Before
https://github.com/hedgedoc/hedgedoc/commit/6c1ca5bd8df57f7a8a053ef6ff691817411617d4
with 1.7.2
:
2021/06/30 18:59:48 Waiting for: tcp://database:5432
2021/06/30 18:59:48 Connected to tcp://database:5432
Sequelize CLI [Node: 12.22.1, CLI: 5.5.1, ORM: 5.22.3]
Parsed url postgres://hedgedoc:*****@database:5432/hedgedoc
== 20180306150303-fix-enum: migrating =======
ERROR: type "enum_Notes_permission" already exists> HedgeDoc@1.7.2 start /hedgedoc
> sequelize db:migrate && node app.js
Sequelize CLI [Node: 12.22.1, CLI: 5.5.1, ORM: 5.22.3]
Parsed url postgres://hedgedoc:*****@database:5432/hedgedoc
== 20180306150303-fix-enum: migrating =======
ERROR: type "enum_Notes_permission" already exists
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! HedgeDoc@1.7.2 start: `sequelize db:migrate && node app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the HedgeDoc@1.7.2 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
with 1.6.0
:
2021/06/30 19:02:24 Waiting for: tcp://database:5432
2021/06/30 19:02:24 Connected to tcp://database:5432
Sequelize CLI [Node: 12.19.1, CLI: 5.5.1, ORM: 5.21.4]
Parsed url postgres://hedgedoc:*****@database:5432/hedgedoc
== 20180306150303-fix-enum: migrating =======
ERROR: type "enum_Notes_permission" already exists
> CodiMD@1.6.0 start /hedgedoc
> sequelize db:migrate && node app.js
Sequelize CLI [Node: 12.19.1, CLI: 5.5.1, ORM: 5.21.4]
Parsed url postgres://hedgedoc:*****@database:5432/hedgedoc
== 20180306150303-fix-enum: migrating =======
ERROR: type "enum_Notes_permission" already exists
npm ERR! code ELIFECYCLEnpm ERR! errno 1
npm ERR! CodiMD@1.6.0 start: `sequelize db:migrate && node app.js`npm ERR! Exit status 1npm ERR!
npm ERR! Failed at the CodiMD@1.6.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /hedgedoc/.npm/_logs/2021-06-30T19_02_29_251Z-debug.log
we always get the same error from the database:
ERROR: type "enum_Notes_permission" already exists
STATEMENT: ALTER TABLE "Notes" ALTER COLUMN "permission" DROP NOT NULL;ALTER TABLE "Notes" ALTER COLUMN "permission" DROP DEFAULT;CREATE TYPE "public"."enum_Notes_permission" AS ENUM('freely', 'editable', 'limited', 'locked', 'protected', 'private');ALTER TABLE "Notes" ALTER COLUMN "permission" TYPE "public"."enum_Notes_permission" USING ("permission"::"public"."enum_Notes_permission");
I already tried:
Running the application from codimd/server:1.6.0
allows to bypass the non-idempotent migration and run the server either way:
2021/06/30 20:40:24 Waiting for: tcp://database:54322021/06/30 20:40:24 Connected to tcp://database:5432Sequelize CLI [Node: 12.19.0, CLI: 5.5.1, ORM: 5.21.4]
Parsed url postgres://hackmd:*****@database:5432/hackmd
== 20180306150303-fix-enum: migrating =======
ERROR: type "enum_Notes_permission" already exists
Wed, 30 Jun 2021 20:40:29 GMT hsts deprecated The "includeSubdomains" parameter is deprecated. Use "includeSubDomains" (with a capital D) instead. at app.js:85:18
(sequelize) Warning: PostgreSQL does not support TEXT with options. Plain `TEXT` will be used instead.
>> Check: http://www.postgresql.org/docs/9.4/static/datatype.html
2021-06-30T20:40:29.741Z info: HTTP Server listening at 0.0.0.0:3000