redsquirrelstudio / laravel-backpack-import-operation

An operation to make configurable imports for your CRUDs using the Backpack api you know and love
Other
17 stars 1 forks source link

No Primary Key Import #15

Closed arb362 closed 9 months ago

arb362 commented 9 months ago

I think this is an absolutely fantastic library and was preparing to integrate it into all my backends. However, I ran into an issue. Unless I am missing something it appears that you can only do an import if there is a primary key column to map to in the import. I want to be able to import a bunch of contacts where the pk is the db auto-increment id field and pre-filling that doesn't make a lot of sense in the spreadsheet. Am I missing something somewhere?

redsquirrelstudio commented 9 months ago

Hi there @arb362

Thank you for your enthusiasm about the package, glad to hear you're finding use out of it.

Based on your comments and following on from

Issue - https://github.com/redsquirrelstudio/laravel-backpack-import-operation/issues/12#issuecomment-1910303281

It looks like it would be good to add in a feature where you can add

$this->withoutPrimaryKey();

In this instance, the import would not update existing models, only create. This would also allow for unique validation to be used.

I've created a new branch to implement this feature :)

redsquirrelstudio commented 9 months ago

Hi again @arb362

I was half way implementing this feature so have finished it off and released it.

Please install v1.6.6 to try it out. Make sure to publish migrations and migrate for the new version to work.

For information on how to use this feature, see This section of the README

Thank you for opening this issue, and for using this package :)

arb362 commented 9 months ago

@redsquirrelstudio Will do!

Thanks!!

redsquirrelstudio commented 9 months ago

Hi @arb362

Is that working all okay for you?

arb362 commented 9 months ago

@redsquirrelstudio It is working fine. Just got it implemented today. Thanks!

redsquirrelstudio commented 9 months ago

@arb362 glad to hear it, happy importing!