[openstreetmap/openstreetmap-website] Future of db/functions? (#3110)
notifications at github.com
Wed Mar 10 17:39:39 UTC 2021
> I did in fact try out to use squasher around last December/January for this project but ran into errors that looked like they are PostgreSQL related … or maybe had something to do with special indexes or primay keys(?) (It might be the same as the composite_primary_keys gem you guys talk about in the Rails6.1 branch).
I got squasher working today - you can see the results at https://github.com/gravitystorm/openstreetmap-website/commit/9890f754c012266617000c1fca025a93bd432ac4 . The trick was to add a `create_extension "btree_gist"` to the first migration, since squasher creates its own database automatically, and that extension is needed for some index stuff later in the 028 migration. The primary key and enum monkey patching doesn't seem to cause any problems.
So squasher seems like a reasonable compromise between removing all the old migrations, but without having to change any workflows, since `rake db:migrate` will still work on an empty database. I'm interested to hear what other people think?
Additional points to consider:
* Should we include the squasher 'cleanup' migration, which removes the no-longer-required entries from the `schema_migrations` table?
* Need to update rubocop config, and check that the output schema matches the migrations (in case there's an edge case in the sql format dumping) since there are test failures.
* I'm also interested if we can move away from SQL format db dumps, which are quite verbose files. There's a [pg_enum gem](https://github.com/alassek/activerecord-pg_enum) that could replace our custom enum code, and that also knows how to dump the enum information back into schema.rb files. If we're also removing the functions, is there anything left that needs SQL format dumps?
* If we decide all this is a bad idea and abandon this work, we should at least remember to add `create_extension "btree_gist"` to the appropriate migration and simplify our install instructions :smile:.
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the rails-dev