simonhamp / laravel-nova-csv-import

The best CSV import component for Laravel Nova
https://novapackages.com/packages/simonhamp/laravel-nova-csv-import
MIT License
166 stars 76 forks source link

Problem with IDs #42

Open philipbaginski opened 2 years ago

philipbaginski commented 2 years ago

Hi!

Probably I'm doing something wrong, but I don;t now what. Trying to import table with of course ID column, and because this IDs are FK in another table, I have to have them the same.

I have 14 models but ID 9 and 12 are not existing, so after import I see 14 models with IDs from 1 to 14.

What should I do to import table with IDs exactly the same as in the file?

And also I have deleted_at column with dates and there is no way to import it.

Added: Column deleted_at can be mapped by added field in the resource, but field ID is not mapped by package.

simonhamp commented 1 year ago

Hey @philipbaginski sorry for taking so long to reply to this.

What should I do to import table with IDs exactly the same as in the file?

This package currently assumes that you're just importing into a fresh table with no relationships. I haven't yet had the need to import rows with specific IDs or update pre-existing rows with imported data. I think this is a good feature request tho.

I'll mark this as an enhancement and hopefully come back around to it at some point. Or maybe someone else will raise a PR for it.