Stolen ruby is an idea behind extracting open-source code into more accessible packages. I noticed that a lot of interesting projects have quite a lot of brilliant code that is unfortunately often embedded into the source and never extracted - which is a shame because often it's very useful stuff and a lot of different people could benefit from it. The idea is to change that - extract those hidden gems and publish them into the world.
Note: cover stolen from well known book.
Stolen from: GitLab; references: merge request, issue
Original author: Patrick Bair; extracted code with very minor modifications, added higher-level Rails integrations tests on top
Rails 6+ with postgresql
Add the following to your Gemfile
:
gem 'conflict_free_schema'
Then install the gem using bundle:
bundle install
Gem will auto-hook into your rails app via Rails::Railtie
Remove conflicts from structure.sql that are caused by tracking the schema_migrations.versions information. To do this, store an empty file named after each version under the db/schema_migrations directory. That way when we versions are added or removed, we add or delete files from the directory, which should not conflict with other changes.
If you're using structure.sql
in your Rails project with postgresql - instead of putting schema version in the sql file upon dump, each migration will be stored as a separate file in db/schema_migrations
(with a SHA hash as content so it's a unique file from git's perspective). If you're doing a lot of structure changes across your organization it should make the life of your developers much easier - resolving conflicts in structure is pain already - even without the need to resolve schema migrations version numbers.
You can spin up docker-based development environment with provided docker-compose
file (useful for Apple M1 users) or simply install dependencies locally.