floor icon indicating copy to clipboard operation
floor copied to clipboard

Upsert

Open loozyoni opened this issue 3 years ago • 8 comments

Hi, I have foreign key in entity B reference to entity A and on delete cascade, For entity A I created method insert with on conflict replace. In case I insert existing entity A for updating some field in it, floor deletes entities in table B with reference to entity in table A. Is there way to insert or update entity A and in case of update it will no delete the entity B? Thanks

loozyoni avatar Jan 16 '23 18:01 loozyoni

I am running into this issue as well. Is there a known solution instead of querying + updating tables and only inserting new entities?

maurycyw avatar Jan 17 '23 20:01 maurycyw

@SEGVeenstra why did you tagged it as low since this is basic feature?

loozyoni avatar Jul 05 '23 04:07 loozyoni

@loozyoni Hi, I'm just starting to clean up the open issues, which where more than 100.

So I'm careful with labeling things high priority.

Since it seemed that it's possible to work around this using updates I just labelled it low for now.

We have Limited availability to work on issues so we have to pick out battles.

Please don't see the labels as being final. Its just a first step in cleaning up the issues.

SEGVeenstra avatar Jul 05 '23 05:07 SEGVeenstra

First thanks. Update will not work if the item is not exist in the db.

loozyoni avatar Jul 05 '23 05:07 loozyoni

I understand, I was referring to this work-around: https://github.com/pinchbv/floor/issues/729#issuecomment-1385992694

I think this is also related to: https://github.com/pinchbv/floor/issues/437#issue-748084755?

SEGVeenstra avatar Jul 05 '23 07:07 SEGVeenstra

@SEGVeenstra Yes.

loozyoni avatar Jul 05 '23 07:07 loozyoni

Any update ?

Velkamhell97 avatar Oct 28 '23 23:10 Velkamhell97

@Velkamhell97 Sorry, no update.

SEGVeenstra avatar Nov 08 '23 20:11 SEGVeenstra