Hello,
Since I updated CodiMD it began to compain about not setting the secretSession key in config.json. I putted here a 64 characters length random key and now I get the folowing error:
Jul 9 17:19:31 hackmd node[13135]: 2018-07-09T17:19:31.375Z - error: message=column "deleteToken" does not exist, name=SequelizeDatabaseError, stack=SequelizeDatabaseError: column "deleteToken" does not exist
Jul 9 17:19:31 hackmd node[13135]: at Query.formatError (/opt/codimd/node_modules/sequelize/lib/dialects/postgres/query.js:357:14)
Jul 9 17:19:31 hackmd node[13135]: at Result.<anonymous> (/opt/codimd/node_modules/sequelize/lib/dialects/postgres/query.js:88:19)
Jul 9 17:19:31 hackmd node[13135]: at emitOne (events.js:116:13)
Jul 9 17:19:31 hackmd node[13135]: at Result.emit (events.js:211:7)
Jul 9 17:19:31 hackmd node[13135]: at Result.Query.handleError (/opt/codimd/node_modules/pg/lib/query.js:163:8)
Jul 9 17:19:31 hackmd node[13135]: at Client.<anonymous> (/opt/codimd/node_modules/pg/lib/client.js:188:26)
Jul 9 17:19:31 hackmd node[13135]: at emitOne (events.js:116:13)
Jul 9 17:19:31 hackmd node[13135]: at Connection.emit (events.js:211:7)
Jul 9 17:19:31 hackmd node[13135]: at Socket.<anonymous> (/opt/codimd/node_modules/pg/lib/connection.js:133:12)
Jul 9 17:19:31 hackmd node[13135]: at emitOne (events.js:116:13)
Jul 9 17:19:31 hackmd node[13135]: SequelizeDatabaseError: column "deleteToken" does not exist
Jul 9 17:19:31 hackmd node[13135]: at Query.formatError (/opt/codimd/node_modules/sequelize/lib/dialects/postgres/query.js:357:14)
Jul 9 17:19:31 hackmd node[13135]: at Result.<anonymous> (/opt/codimd/node_modules/sequelize/lib/dialects/postgres/query.js:88:19)
Jul 9 17:19:31 hackmd node[13135]: at emitOne (events.js:116:13)
Jul 9 17:19:31 hackmd node[13135]: at Result.emit (events.js:211:7)
Jul 9 17:19:31 hackmd node[13135]: at Result.Query.handleError (/opt/codimd/node_modules/pg/lib/query.js:163:8)
Jul 9 17:19:31 hackmd node[13135]: at Client.<anonymous> (/opt/codimd/node_modules/pg/lib/client.js:188:26)
Jul 9 17:19:31 hackmd node[13135]: at emitOne (events.js:116:13)
Jul 9 17:19:31 hackmd node[13135]: at Connection.emit (events.js:211:7)
Jul 9 17:19:31 hackmd node[13135]: at Socket.<anonymous> (/opt/codimd/node_modules/pg/lib/connection.js:133:12)
Jul 9 17:19:31 hackmd node[13135]: at emitOne (events.js:116:13)
Jul 9 17:19:31 hackmd node[13135]: 2018-07-09T17:19:31.417Z - info: ::ffff:10.10.10.10 - - [09/Jul/2018:17:19:31 +0000] "POST /login HTTP/1.1" 500 148 "https://pad.unixcorn.org/" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0"
Thanks in advance for your help.
:pray:
I experienced the same thing when i restore a database from v0.5.1.
Maybe a migration script is missing?
Can someone help us doing this migration from the old HackMD?
Does somebody can help please? Any clue? :-/
Since it seems like no one else makes it to answer this…
This error comes from the recent changes that add a user deletion function.
Please check that you run all instructions that are mentioned in the
README sections about upgrades.
Also check for possible migration errors. If you have migration errors
please check https://github.com/hackmdio/codimd/pull/894 and see if it
can fix them.
On 07/21/2018 10:51 PM, mathiasblc wrote:
Does somebody can help please? Any clue? :-/
>
Signed
Sheogorath
Hello @SISheogorath, thanks for answering.
I took care of running all the steps mentioned in the READMEs upgrade section. Sadly errors aren't related to the #894 PR.
I'll provide some logs soon.
Ok, now i can make things work. Here is what i think and what is did.
The problem is with the migration process itself.
When the new version creates the SequelizeMeta table it is empty. So the sequelizer tries to run all the migrations from the migration folder. Some of them are fail because the columns they try to create already exist.
So when i removed the following migrations, the others succeded and the hackmd is up and running:
Without these scripts the migration can be completed. It is interesting that 20180306150303-fix-enum also fails but it does not stop the migration process. Maybe that should be the correct behaviour in case of the other scripts too.
However migration deletion is not the best solution because in the future sequelizer will try to run this scripts again and the migration process will break again. So i will manually insert these lines into the SequelizeMeta as they were successfully migrated.
This is far from ideal but this is the only way i can achieve the update.
@SISheogorath Am i right, that the SequelizeMeta table should be populated with all the old migration lines and the migration process should be 0.x -> 0.5.2 -> 1.x In this case there won't be a problem like this.
@mathiasblc hope this helps
Migrations should work now. The recent changes resolved all problems on the demo instance and also on some user setups so I hope this is fixed.
In some minor cases you may need to add a new default to the SequelizeMeta table for createdAt and updatedAt. Doing this is up to everyone who faces it manually since we don't directly control this table and I really try to avoid adding migrations for that as well.
Hope this helps everyone. I also purposed a change that, when you use npm start, will run the db migrations on every startup. We already do this in the container image.
I just updated my instance that runs on Docker to v1.2.0 doing git pull, docker-compose down and docker-compose up -d and the migration did not work, obviously. The log had
error: SequelizeDatabaseError: column owner.deleteToken does not exist
as mentioned earlier in this issue.
Since I came here via search engine, I would like to drop a note how I fixed it: I added the missing column manually :)
Disclaimer: this is pretty hacky, use at your own risk!
Enter the database container and run psql using the hackmd user:
$ docker exec -ti hackmd_db_1 psql -U hackmd
Being inside this, check whether the column exists:
hackmd=# \d+ "Users"
If missing, add the column:
hackmd=# ALTER TABLE public."Users" ADD COLUMN "deleteToken" uuid;
Check again, the missing column deleteToken should be there now.