go-testfixtures / testfixtures

Ruby on Rails like test fixtures for Go. Write tests against a real database
https://pkg.go.dev/github.com/go-testfixtures/testfixtures/v3?tab=doc
MIT License
1.12k stars 80 forks source link

feat: overriding system value for PostgreSQL's identity column #183

Closed amakmurr closed 5 months ago

amakmurr commented 9 months ago

Add OVERRIDING SYSTEM VALUE insert clause when using PostgreSQL with version >= 10 dialect. It's necessary for table with always generated identity column also as primary key. By default those column must be always generated by PostgreSQL, but in this fixtures mostly case we want to define ourself id especially when declaring the relationship between fixtures.

This PR will allow you to force define value for column that has been made with such as statement id BIGSERIAL GENERATED ALWAYS AS IDENTITY PRIMARY KEY

Reference:

amakmurr commented 8 months ago

Hi @andreynering , I am just updating this PR and apply your suggestion. Also has been run the unit test for mysql in my local machine and it's works now. Please kindly take another look.

Thank you.

andreynering commented 5 months ago

Thanks @amakmurr!

I did some very simple improvements at b6a9478065da83965563b1196a1889b6b6dabf61.