Skip to content
This repository has been archived by the owner on Oct 10, 2022. It is now read-only.

Entity Generation breaking with Postgres enum columns when --tables or --skip-tables is specified #314

Open
bencpeters opened this issue Dec 17, 2020 · 0 comments
Labels
bug no known workaround

Comments

@bencpeters
Copy link

When I run the model generation on a Postgres DB with a custom enum-based column, I'm getting an error if I try to limit the tables using either --tables or --skip-tables. Model generation works fine if I omit these options.

This is the error:

[9:59:57 AM] Starting creation of model classes.
Unknown ARRAY column type: _volunteer_type_enum table name: users column name: volunteer_type
Error occurred in typeorm-model-generator.
[email protected]  [email protected]
If you think this is a bug please open an issue including this log on https://github.com/Kononnable/typeorm-model-generator/issues
Error
    at Object.LogError (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/Utils.js:14:21)
    at /Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/drivers/PostgresDriver.js:75:35
    at Array.forEach (<anonymous>)
    at /Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/drivers/PostgresDriver.js:56:18
    at Array.forEach (<anonymous>)
    at PostgresDriver.GetCoulmnsFromEntity (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/drivers/PostgresDriver.js:53:18)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async PostgresDriver.GetDataFromServer (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/drivers/AbstractDriver.js:119:9)
    at async Object.createModelFromDatabase (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/Engine.js:34:19)
    at async CliLogic (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/index.js:27:5)
(node:37928) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'relations' of undefined
    at /Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/ModelCustomization.js:190:49
    at Array.forEach (<anonymous>)
    at /Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/ModelCustomization.js:185:30
    at Array.forEach (<anonymous>)
    at changeRelationNames (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/ModelCustomization.js:184:15)
    at applyNamingStrategy (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/ModelCustomization.js:163:18)
    at Object.modelCustomizationPhase [as default] (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/ModelCustomization.js:57:14)
    at Object.createModelFromDatabase (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/Engine.js:39:43)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async CliLogic (/Users/benpeters/Dev/ovio/ovio-xplore-app/node_modules/typeorm-model-generator/dist/src/index.js:27:5)
(node:37928) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:37928) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
✨  Done in 3.75s.

volunteer_type is a simple custom enum:

CREATE TYPE public.volunteer_type_enum AS ENUM (
    'MENTORING_ORGANIZATIONS',
    'MENTORING_STUDENTS',
    'VOLUNTEERING_PROJECT_BASED',
    'VOLUNTEERING_TASK_BASED'
);

CREATE TABLE public.users (
   -- other fields
   volunteer_type public.volunteer_type_enum[]
);
@bencpeters bencpeters changed the title Entity Generation breaking with postgres enum columns when --tables or --skip-tables is specified Entity Generation breaking with Postgres enum columns when --tables or --skip-tables is specified Dec 17, 2020
@Kononnable Kononnable added the bug no known workaround label Jan 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug no known workaround
Projects
None yet
Development

No branches or pull requests

2 participants