laravel-nova-csv-import icon indicating copy to clipboard operation
laravel-nova-csv-import copied to clipboard

Problem with IDs

Open philipbaginski opened this issue 2 years ago • 1 comments

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.

philipbaginski avatar Jun 04 '22 20:06 philipbaginski

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.

simonhamp avatar Mar 05 '23 20:03 simonhamp