gristlabs / grist-core

Grist is the evolution of spreadsheets.
https://www.getgrist.com/
Apache License 2.0
7.11k stars 317 forks source link

Not worked with postgres #151

Open StdCarrot opened 2 years ago

StdCarrot commented 2 years ago

Working on commit: 21f2765a59061c3df481c1c7cfd3e51b27405127 Postgres Version: 12.1

There is some wrong with ORM.

It shows the error:

DataTypeNotSupportedError: Data type "datetime" in "Workspace.removedAt" is not supported by "postgres" database.
    at new DataTypeNotSupportedError (~/grist-core/node_modules/typeorm/error/DataTypeNotSupportedError.js:7:28)
    at ~/grist-core/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:73:27
    at Array.forEach (<anonymous>)
    at EntityMetadataValidator.validate (~/grist-core/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:70:36)
    at ~/grist-core/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:41:74
    at Array.forEach (<anonymous>)
    at EntityMetadataValidator.validateMany (~/grist-core/node_modules/typeorm/metadata-builder/EntityMetadataValidator.js:41:25)
    at Connection.buildMetadatas (~/grist-core/node_modules/typeorm/connection/Connection.js:500:33)
    at Connection.<anonymous> (~/grist-core/node_modules/typeorm/connection/Connection.js:126:30)
    at step (~/grist-core/node_modules/tslib/tslib.js:141:27)
    at Object.next (~/grist-core/node_modules/tslib/tslib.js:122:57)
    at fulfilled (~/grist-core/node_modules/tslib/tslib.js:112:62)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
paulfitz commented 2 years ago

Hmm, what version of the pg package do you have? Our tests run with pg version 8.6.0. Does your typeorm version match that set in yarn.lock?

StdCarrot commented 2 years ago

I just run yarn add pg then it install pg@^8.7.3.

paulfitz commented 2 years ago

I did a test running postgres@11 as:

docker run --rm --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword postgres:11

Then doing yarn add pg, then setting:

export TYPEORM_TYPE=postgres
export TYPEORM_DATABASE=postgres
export TYPEORM_USERNAME=postgres
export TYPEORM_PASSWORD=mysecretpassword
export TYPEORM_HOST=localhost
export TYPEORM_LOGGING=true

Then if I do yarn start and visit http://localhost:8484, all seems to work as expected.

Running postgres@12 as:

docker run --rm --name some-postgres -p 5432:5432 -e POSTGRES_PASSWORD=mysecretpassword postgres:12

I hit a problem where the version of typeorm (0.2.18) we use doesn't support postgres 12. Upgrading typeorm causes slower performance for a reason we haven't pinned down yet, but if I do it anyway (getting version 0.2.44), everything seems to work as expected.

At what point do you see the DataTypeNotSupportedError error?