-
Notifications
You must be signed in to change notification settings - Fork 21.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dump PostgreSQL primary key with custom function as a default. #16127
Conversation
@@ -117,6 +117,13 @@ def enable_uuid_ossp!(connection) | |||
return true if connection.extension_enabled?('uuid-ossp') | |||
|
|||
connection.enable_extension 'uuid-ossp' | |||
# Create custom PostgreSQL function to generate UUIDs | |||
# to test dumping tables which columns have defaults with custom functions | |||
connection.execute <<-SQL |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe it better to place it inside the test that use it
Squash please |
For example, if use pgcrypto extension in PostgreSQL 9.4 beta 1, where uuid-ossp extension isn't available for moment of writing, and thus to use a gen_random_uuid() method as a primary key default. In this case schema dumper wasn't able to correctly reconstruct create_table statement and lost primary key constraint on schema load. Fixes #16111.
I've squashed it few days ago, is there anything I should to do yet? |
Dump PostgreSQL primary key with custom function as a default.
Thanks -- there's no notification when it's updated |
Thanks, will know about notification absense in future. Can I backport this pull request in 4-1-stable? |
Dump PostgreSQL primary key with custom function as a default. Conflicts: activerecord/CHANGELOG.md activerecord/test/cases/adapters/postgresql/uuid_test.rb
Done: 136cbca |
Fixes #16111. See it for more information.
For example, if I use pgcrypto extension in PostgreSQL 9.4 beta 1, where uuid-ossp extension isn't available for moment of writing, and thus required to use a gen_random_uuid() method as a primary key default.
In this case schema dumper wasn't able to correctly reconstruct create_table statement and lost primary key constraint on schema load.
If I create migration in PostgreSQL 9.4 beta 1 as:
Schema dumper currently dumps it as this:
Instead of this:
What about to also backport it to 4-1-stable?