silverstripe / silverstripe-populate

Populate your database through YAML files
BSD 3-Clause "New" or "Revised" License
26 stars 24 forks source link

truncate_objects is not longer an array. #42

Open LiamKearn opened 2 years ago

LiamKearn commented 2 years ago

truncate_objects is no longer an array and seems to be causing issue for us.

I think this is related to the removal of the default in #32 .

LiamKearn commented 2 years ago

EG. https://github.com/silverstripe/silverstripe-populate/pull/32/files#diff-93dc79eb6bab3a17b4ea782351fd413f3b01e654949378c6b8dd974acdbc26ecR81 Foreach expects to iterate but doesn't get an iterable. Probably because it was removed here: https://github.com/silverstripe/silverstripe-populate/pull/32/files#diff-93dc79eb6bab3a17b4ea782351fd413f3b01e654949378c6b8dd974acdbc26ecL38.

Not sure what config returns if the config option is never set but It might be the cause.

davejtoews commented 2 years ago

It's not an array because it's undefined unless you set a value in your app.yml. Ran into the same issue myself. If you don't want to truncate anything you can set an empty array in app.yml to prevent the error.

DNADesign\Populate\Populate:
  truncate_objects: []
LiamKearn commented 2 years ago

Thanks @davejtoews, should have moved to fix this when I discovered it!

This will make our CI a little cleaner if when we update next :)

DanielTate commented 1 year ago

This should be in the readme.

DanielTate commented 1 year ago

Is there a way to truncate only the objects created using the module?

michalkleiner commented 1 year ago

Is there a way to truncate only the objects created using the module?

No. There's no record or a way of knowing which objects were created by this module and which existed before or after.