{"repo":"lfittl/activerecord-clean-db-structure","free":true,"listed":false,"github":"https://github.com/lfittl/activerecord-clean-db-structure","clone":"git clone https://github.com/lfittl/activerecord-clean-db-structure.git","description":"Automatic cleanup for the Rails db/structure.sql file (ActiveRecord/PostgreSQL)","language":"Ruby","stars":163,"topics":["activerecord","postgresql","rails","database","postgres"],"license":"BSD-3-Clause","category":"databases-storage","readme_excerpt":"activerecord-clean-db-structure Ever been annoyed at a constantly changing db/structure.sql file when using ActiveRecord and Postgres? Spent hours trying to decipher why that one team member keeps changing the file? This library is here to help! It cleans away all the unnecessary output in the file every time its updated automatically. This helps avoid merge conflicts, as well as increase readability. Installation Add the following to your Gemfile: This will automatically hook the library into your rake db:migrate task. Supported Rails versions Whilst there is no reason this shouldn't work on earlier versions, this has only been tested on Rails 4.2 and newer. It also assumes you use ActiveRecord with PostgreSQL - other ORMs or databases are not supported. Caveats Currently the library assumes all your id columns are either SERIAL, BIGSERIAL or uuid. It also assumes the id is the primary key. Multi-column primary keys, as well as tables that don't have id as the primary key are not supported right now, and might lead to wrong output. You can disable this part of the cleaning process in your config/environments/ .rb (or config/application.rb ): Other options group table definition You can optionally place indexes and constraints (limited to deferrable ones) after the main tables by setting group table definition: When it is enabled the structure looks like this: order column definitions To enable sorting the table column definitions alphabetically, discarding the actual order p","default_branch":null,"files":null,"tree":[],"storefront":"/r/lfittl","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/lfittl/activerecord-clean-db-structure/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}