polo
polo copied to clipboard
Preliminary pg upsert support
Implemented two ways,
1. "naive upsert" for pg < 9.5
insert into, on exception update all the things.
2. real upsert since 9.5
INSERT INTO .... ON CONFLICT id DO UPDATE SET ...
Also included a fix for exporting ActsAsTaggableOn - AATO adds it's own "tag_list" as a virtual attribute into the record.attributes
, thus, is included in the "INSERT" statement.
The ac88b32 fixes that problem by comparing the attributes with column_names.
Would be nice if some user PG user would test it...
@zealot128 if you wouldn't mind rebasing master and getting a green build, we can finally merge this 😅
@zealot128 if you wouldn't mind rebasing master and getting a green build, we can finally merge this 😅
Squashed rebase is pushed. Let me know if there are any other issues.
looks like there is one legitimate exception:
expect { adapter.on_duplicate_key_update(double(), double()) }.to raise_error('on_duplicate: :override is not currently supported in the PostgreSQL adapter')
makes sense. can you fix the spec? otherwise i may be able to help at some point.