-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pgen command not working and not giving any message besides Socket is closed #70
Comments
I cannot repeat the problem. Did you possibly mistype the port? |
I am using a docker instance of PostgreSQL, so am able to connect to PostgreSQL from my node, java and IDE Applications, but when I use the package to generate the models, it keeps saying the socket is closed. docker exposes the PostgreSQL instance on the host IP, with 6432 port as specified in the docker compose yml file docker compose file
|
I didn't use it with docker. Could you please provide a repo and write steps to reproduce the issue, so I will investigate if I can help. |
For everyone reaching this, I had this issue with node 14.X. Node 12.X seems to work fine. |
@q8tywolf and @sfratini thanks for the case and warning. I released a new major version of the pg-generator compatible with the latest Node, which is currently in the alpha stage. It is written from scratch. What's New:
Also, documentation is completed. Please see pg-generator.com. Example of using with objection2: $ npm install -g pg-generator@5.0.0-alpha.8 pg-generator-example
$ pgen example:objection2 --out-dir models --clear --relation-name-functions optimal" Please provide your feedback if possible. Kind Regards, |
Hello I still getting Am I doing something wrong? Regards |
You are doing ok. It's normal to have name collisions in some complex database structures. First try to use this option: If you still get naming collision you have 2 ways: a. (Easier) Try to rename foreign keys in your database. |
solution a. the foreign keys are unique in the database, but when you have table a and b Table A Table B Some relations have same names. Use "optimal" or "descriptive" for "relationNameFunctions" option or proivde your own naming functions. |
When you get this warning, it the command supposed to exit without generating any models? I would expect models without conflicting relation names to be generated. |
Yes, this is on purpose. If there is a conflict, nothing is generated. Otherwise, you would have corrupted models. Possible problems:
|
Ok. In my case, I don't actually care about the models for which there are conflicting names. So an option to generate the models anyway or an option to exclude certain tables would be nice. |
Hello @ozum There is an issue with the alpha version when i run the process i get an error for example I get:
TypeError: Cannot read property 'table' of undefined if I remove the -i and add
|
You should write the actual schema name instead of
In your second example, you
|
Hello
I would like to thank you on this package very useful, and extremely handy,
I have been using it on previous version but recently have the following problem,
when I run the pgen command I get the internal command is about to executed but no feed back,
info: Executing command: pgen.js exec sequelize-main-template --host 192.168.0.13 --port 6432 --user admin --database mydb --schema main --target src/models/main --log info --extension nunj.html --indent 4 --env development
so I copied the command and it asks for a password, and then it says
Socket is closed
Can you please help
The text was updated successfully, but these errors were encountered: