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

Duplicate tables across schema are incorrectly generated #208

Open
ebrahimB opened this issue Sep 28, 2019 · 0 comments
Open

Duplicate tables across schema are incorrectly generated #208

ebrahimB opened this issue Sep 28, 2019 · 0 comments
Labels
enhancement new feature or bug with easy workaround

Comments

@ebrahimB
Copy link

ebrahimB commented Sep 28, 2019

Assume the following DB setup:

- schema_1
    - user
    - migration
- schema_2
    - category
    - migration

Running the following command:

typeorm-model-generator -d schema_1,schema_2 -h $dbhost -u $user -x $password -p 3306 -e mysql -o "$output" --cf "camel" --ce "pascal" --cp "camel" --noConfig --relationIds true

will result in the 3 output files: user, migration, and category. The problem is that the migration file is being updated and columns appended instead of a new file being generated. So the output file will have something like the following:

...
    @PrimaryGeneratedColumn({
        type:"int", 
        name:"id"
        })
    id:number;
        

    @PrimaryGeneratedColumn({
        type:"int", 
        name:"id"
        })
    id:number;
...

even though there is a single id column in either table.

My initial issue was similar to #144 but just generating the files from all the schema has the above mentioned downside. I could rename all my tables to be unique.

I'd propose adding a way to exclude tables from being generated (or entire schema from being generated). That way the other schema could be included in generation (in my case for cross schema foreign keys) and the duplicate models wouldn't be an issue.

Another proposal would be to create an output folder for each schema. That was all tables are unique in their folders. This is similar to #204.

Let me know if there is anything I can do to help!

@Kononnable Kononnable added the enhancement new feature or bug with easy workaround label Oct 1, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement new feature or bug with easy workaround
Projects
None yet
Development

No branches or pull requests

2 participants