Closed maneyko closed 2 years ago
I have a more fundamental question. What does PG Saurus do that Rails 6 doesn't do out of the box?
I believe there still is some functionality that we get out of PgSaurus
but it acts more as a DSL a this point, rather than adding new functionality to Rails. One of the main things PgSaurus
supports that Rails does not (I think) is using different schemas within a single Rails application. I did look in to dropping support for PgSaurus
but it was easier to just extend it to support Rails 6.
I don't think this is a reason to never support Rails 6 for PgSaurus
, but the 5.x versions of PgSaurus
can be viewed as a transition to move logic entirely back to Rails.
@albertosaurus, IIRC PgSaurus
is still required to support PG schemas. My (possibly mistaken) understanding is that Rails 6 does not support them, or does not support them as richly as PgSaurus
.
Many of the
ActiveRecord
internals thatPgSaurus
relies on have changed from Rails 5 to Rails 6. Beginning support for Rails 6 will requirePgSaurus
to be bumped up to5.0.0
and lose compatibility with Rails 5 and below.Main changes:
pg_saurus
patch labeledPatch 1
has moved fromActiveRecord::ConnectionAdapters::PostgreSQLColumn#serial?
toActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements#new_column_for_field
ActiveRecord::ConnectionAdapters::PostgreSQL::SchemaStatements
between Rails 5 and Rails 6. The entire index creation has moved toActiveRecord::ConnectionAdapters::SchemaCreation
binds
was added toActiveRecord::StatementInvalid
and is a required positional argument in a few other related methods. This logic was introduced in Rails PR rails/rails#34468I have tested these changes on a medium-sized project locally that uses Rails 6+ and Ruby 2.7+ and am not experiencing any issues.
Further, I have dropped, created, and migrated this app for both Rails 5 and Rails 6 and the dumps are nearly identical. Here is the command I did to create the DB dump:
The only difference between the dump between
rails5.sql
andrails6.sql
is that Rails 6 adds a constraint oncreated_at
andupdated_at
timestamp fields: