GithubHelp home page GithubHelp logo

Comments (6)

MINDoSOFT avatar MINDoSOFT commented on June 11, 2024 1

First of all, thank you for replying !

OK, as far as I understand when you set seedTracking to true it allows you to run the same seed multiple times.

Actually my issue is different.

Let me give you an example scenario.

I have two different files:

  • microserviceASeeds.ts
  • microserviceBSeeds.ts

microserviceASeeds has seeds for EntityA.
microserviceBSeeds has seeds for EntityA again, and EntityB. (they are test data)

With current implementation of typeorm-extension, running this seeds using seed:run cli command, fails because 'checkForDuplicates' throws exception.

Is it possible to skip the checkForDuplicates validation in seed:run ? By providing another cli flag, maybe it can be named 'allowDuplicateEntities' ?

Thanks again.

from typeorm-extension.

tada5hi avatar tada5hi commented on June 11, 2024 1

Strange. It can only be a duplicate if the class name is the same. That is everything, the checkDuplicates function ensures and that should also never happen.
Could you provide a minimal reproduction repo?

from typeorm-extension.

MINDoSOFT avatar MINDoSOFT commented on June 11, 2024 1

Yes sir, you are correct. :)

It was indeed my issue, I had duplicate class names by mistake.

Thanks again for your time and very fast response !

from typeorm-extension.

tada5hi avatar tada5hi commented on June 11, 2024

It is possible to define that a seeder is only executed once.
This can either be set globally using the seedTacking option or locally using the track property of a seeder class.

You are very welcome.
By default, you should be able to execute a seeer mulitple times.

from typeorm-extension.

tada5hi avatar tada5hi commented on June 11, 2024

You are welcome!
When you set seedTracking to true, the seeder will not be executed more than once.
Ah now I get the problem. Your seeder class name might be the same, what shouldn't be the case

from typeorm-extension.

MINDoSOFT avatar MINDoSOFT commented on June 11, 2024

The seeder class names are different.
It is the entities used in the seeders that might be the same, at least that is my scenario.

One entity class might be used in multiple seeders.

Hope it is clear.

from typeorm-extension.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.