Skip to content
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

[Request] Support for typeorm 0.3 and nestjs/typeorm v8.1.0 #228

Open
mehedi-iitdu opened this issue Jun 25, 2022 · 20 comments
Open

[Request] Support for typeorm 0.3 and nestjs/typeorm v8.1.0 #228

mehedi-iitdu opened this issue Jun 25, 2022 · 20 comments

Comments

@mehedi-iitdu
Copy link

mehedi-iitdu commented Jun 25, 2022

Can you please add support for TypeORM v0.3 and above and nestjs/typeorm v8.1.0 and above?

@Hyra10
Copy link

Hyra10 commented Jul 6, 2022

I tried upgrading Typeorm to 0.3.7
and typeorm-seeding threw an error saying

Cannot find module 'typeorm/driver/aurora-data-api/AuroraDataApiConnectionOptions' or its corresponding type declarations.

I guess this has something to do when upgrading to 0.3

@MrMaz
Copy link

MrMaz commented Jul 7, 2022

My company has created a fork that is a combination of this project and v3.2.0 on the Jorge Bodega fork. We decided to go in a different direction with the API and how to do TypeORM 0.3 support.

This is not a drop in replacement, but if you need TypeORM v0.3 support you can start using it immediately with some small changes.

https://github.com/conceptadev/typeorm-seeding

@jorgebodega
Copy link
Collaborator

jorgebodega commented Jul 7, 2022

Oh, nice!

What are the differences? I'm still working on supporting 0.3 but I'm a bit stuck. Would be great to have some new ideas.

Also, @mehedi-iitdu as you can see on #201 I cannot automate deploy of versions, and I don't have time for taking care of this library and manually deploy new versions.

@MrMaz
Copy link

MrMaz commented Jul 7, 2022

@jorgebodega your idea with the factorized attributes for version 4 is really cool and i tried to make it work, but for our case is a bit too difficult to debug unit tests, and also would require too much refactoring on our projects. we are addicted to the map i guessing, lol.

we are instead creating an "overrides api" for entity customization and sub-factories at run time. having factories and seeders that are re-useable is a high priority for us. we are re-using your seeder tree pattern with some minor tweaks.

TypeORM v0.3 support was tricky because they basically dropped support for connection name and ormconfig file. if you look at our source you can see how we basically do that from scratch now without relying on the TypeORM config options loader at all.

would love to collaborate with you more on this. i believe both seeder styles have a place.

@jorgebodega
Copy link
Collaborator

The most painful part of upgrading TypeORM is the connection refactor, that is true, and I really don't like how the Seeder actually work, like a tree, so I'm really open to any idea on how to improve that.

@MrMaz
Copy link

MrMaz commented Jul 7, 2022

@jorgebodega i like the tree, but not that we are forced to have one root. i am going to make a change on our fork where it runs all seeders in order by default, unless you supply one or more root seeders, it will run those each like a tree.

@jorgebodega
Copy link
Collaborator

My idea for the next version is just to remove the tree and run all the seeders in order, letting the users to choose the order with 01-Seeder or 01Seeder or something like.

This is just I don't like the idea of run seeders as a side effect of running others, and how that could affect to testing and execution.

Do you use the seeder with some root as entry? Every feedback is welcome

@DaggerJackfast
Copy link

Hello everyone, has any updates on the issue?

@jorgebodega
Copy link
Collaborator

No plans to work on this since I can work on this but cannot deploy.

If you can wait until someone came back to work or give me access, it's ok. But I released every change I did on another library, @jorgebodega/typeorm-seeding

@dbpolito
Copy link

@jorgebodega looking at this comment #201 (comment) it seems you now have maintenance over the npm repo...

is there anything else blocking you that someone can assist? Or really depends on the author?

@jorgebodega
Copy link
Collaborator

I don't have permissions to add secrets to github, so I cannot add the deploy system I've worked on my fork, and I won't do it manually.

So until I have admin access, I won't work on this. If you need recent support, try to work with the latest version of my fork.

@sergiuchilat
Copy link

Hi.
Also have this problem.
When running config, everything is ok.
But when run seeding I got an error MissingDriverError: Wrong driver: "undefined" given.

@tada5hi
Copy link

tada5hi commented Oct 4, 2022

You can also give https://github.com/tada5hi/typeorm-extension a try. Recently i added seeding support, which is highly inspired by this library and the usage should be the same like before.

@jorgebodega the library could also be interesting for you, to use the singleton state management for your reimplementation https://www.npmjs.com/package/typeorm-extension#instances

@flowluap
Copy link

flowluap commented Mar 3, 2023

Our company also maintains a fork of typeorm-seeding but with context support, that has been very important for us. Currently typeorm 0.3.12 is supported. https://github.com/paralo-official/typeorm-seeding

@MrMaz
Copy link

MrMaz commented Mar 6, 2023

Our company also maintains a fork of typeorm-seeding but with context support, that has been very important for us. Currently typeorm 0.3.12 is supported. https://github.com/paralo-official/typeorm-seeding

Hi Paul. Let me know if you want to collaborate on this fork.

@flowluap
Copy link

flowluap commented Mar 6, 2023

Our company also maintains a fork of typeorm-seeding but with context support, that has been very important for us. Currently typeorm 0.3.12 is supported. https://github.com/paralo-official/typeorm-seeding

Hi Paul. Let me know if you want to collaborate on this fork.

Definitely interested. jorgebodega also has a fork I think. We should put our efforts into one fork I think...
For us the context has been very important.
What do you think on this?

@MrMaz
Copy link

MrMaz commented Mar 6, 2023

Our company also maintains a fork of typeorm-seeding but with context support, that has been very important for us. Currently typeorm 0.3.12 is supported. https://github.com/paralo-official/typeorm-seeding

Hi Paul. Let me know if you want to collaborate on this fork.

Definitely interested. jorgebodega also has a fork I think. We should put our efforts into one fork I think... For us the context has been very important. What do you think on this?

Yes I like the idea of adding the context back. Ours is a fork of Jorge's project, but we decided to go in a slightly different direction and set context aside for later. I just created a thread on our repo so we can have the discussion there.

conceptadev#4

@jorgebodega
Copy link
Collaborator

I have a fork just to have a functional version of the code, but there are some changes, context is the main one, just because I don't see why it should stay in my version with the changes.

If you want to add me in the discussion, just ping me.

nardev added a commit to nardev/rootspace that referenced this issue Apr 25, 2023
Task: https://rootspace.app/taskboard/6/item/1567/type-orm-and-nested-set-tree-issue

Remaining issues:
 Now, the typeorm-seeding is not compatible with newer version of
typeorm so we have to make upgrade of seeders. I was not able to find
dropin replacement.

 more: w3tecch/typeorm-seeding#228
@apudiu
Copy link

apudiu commented Jul 1, 2023

Our company also maintains a fork of typeorm-seeding but with context support, that has been very important for us. Currently typeorm 0.3.12 is supported. https://github.com/paralo-official/typeorm-seeding

Thank you for making the lib compatible with typeORM 0.3.x

I've followed the instructions on https://github.com/paralo-official/typeorm-seeding/blob/main/README.md
After running npm run seed:run I'm getting following error```

✔ Seeding Config seeding-source.js loaded
✖ Could not load the seeding source config file at seeding-source.js! Orginal error was: seedingSource.initialize is not a function
Could not load the seeding source config file at seeding-source.js! Orginal error was: seedingSource.initialize is not a function

scripts in package.json

"seed:config": "typeorm-seeding config -r ./dist/db -c seeding-source.js",
"seed:run": "typeorm-seeding seed -r ./dist/db -c seeding-source.js"

my folder structure (in project root)

db
    factories
    seeders
    seeding-source.ts

Please help me understand what's wrong here.

@apudiu
Copy link

apudiu commented Jul 1, 2023

I've found the solution, I think the docs need a little improvement. As the docs suggested, I've created SeedingSource class but that needs to be imported from the package. This part also confuses me how does this work!!, Now seeding OK

// result of misleading doc's, need to import this class from package <<
// class SeedingSource {
//   constructor(public options: SeedingSourceOptions) {}
// }

export default new SeedingSource({
  dataSource: DataSource,
  seeders: [UserSeeder],
  // defaultSeeders: [UserSeeder],
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants