CARVIEW |
Navigation Menu
-
Notifications
You must be signed in to change notification settings - Fork 22k
support dumping PostgreSQL inheritance & partitioning options to schema.rb
#50475
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
Conversation
Hi @fatkodima, I've seen that you've done some work lately surrounding updates to the Postgres migrations and schema support in ActiveRecord. Would you mind taking a look at this and let me know if you think of it? |
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.
Made some suggestions. Not sure about the feature by itself.
And please keep all the changes in 1 commit.
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Outdated
Show resolved
Hide resolved
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Outdated
Show resolved
Hide resolved
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Outdated
Show resolved
Hide resolved
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.
thanks for your review @fatkodima! made some updates and left a couple responses. do you have a recommendation of who might be a good candidate for me to ping about the merit of the feature being included?
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Outdated
Show resolved
Hide resolved
activerecord/lib/active_record/connection_adapters/postgresql/schema_statements.rb
Outdated
Show resolved
Hide resolved
No need to ping anyone, just wait some time for some other reviewers (or ask for reviews in discord channel). |
schema.rb
4875a81
to
9fa4d44
Compare
@fatkodima pushed up a squashed commit, thanks for your time |
9fa4d44
to
3f9e3fc
Compare
PostgreSQL native partition is one of them, not everything. It eventually add the string specified in the |
Hi @yahonda. Yes, this is just one of things that https://www.postgresql.org/docs/current/sql-createtable.html Using the Thanks for your time, let me know what you think. |
As a delayed follow-up, i pushed up support for |
85413da
to
1be1f0c
Compare
schema.rb
schema.rb
It's been a while so I figured I'd bump this again in hopes to revive discussion about it. I've been using this patch on a real production Rails app for about 9 months and it has been working well. I think it would be nice if Rails started to support more |
1be1f0c
to
c225ff7
Compare
c225ff7
to
fba7ef0
Compare
Motivation / Background & Detail
create_table
provides anoptions:
key that allows you to append options to your table definition. One of the things you can do this way with PostgreSQL 10+ is use native partitioning to declare partitioning definitions:Adding this to a migration and running it will properly create the partitioned table in development, but the dumped schema will not persist the specified partitioning options. Therefore, if you run your test suite which loads from
schema.rb
, your test database's table won't be properly partitioned.This PR extends the PostgeSQL adapter's schema statements so that it can dump this partitioning definition as defined in the relevant system tables.
Checklist
Before submitting the PR make sure the following are checked:
[Fix #issue-number]