{"id":18656597,"url":"https://github.com/zendesk/migration_tools","last_synced_at":"2025-04-05T20:06:45.117Z","repository":{"id":47055650,"uuid":"1135708","full_name":"zendesk/migration_tools","owner":"zendesk","description":"Rake tasks for Rails that add groups to migrations","archived":false,"fork":false,"pushed_at":"2024-10-04T13:03:17.000Z","size":133,"stargazers_count":23,"open_issues_count":2,"forks_count":8,"subscribers_count":418,"default_branch":"main","last_synced_at":"2025-03-29T19:04:35.279Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zendesk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2010-12-03T16:56:08.000Z","updated_at":"2024-08-19T13:37:35.000Z","dependencies_parsed_at":"2023-11-26T17:31:43.825Z","dependency_job_id":"1c541e5f-038f-4498-ab48-1acfa49b1998","html_url":"https://github.com/zendesk/migration_tools","commit_stats":{"total_commits":105,"total_committers":15,"mean_commits":7.0,"dds":0.6476190476190475,"last_synced_commit":"1b310d7fa48464d8642d623f5244e25a3de2c012"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fmigration_tools","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fmigration_tools/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fmigration_tools/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zendesk%2Fmigration_tools/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zendesk","download_url":"https://codeload.github.com/zendesk/migration_tools/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247393569,"owners_count":20931812,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T07:24:14.042Z","updated_at":"2025-04-05T20:06:45.032Z","avatar_url":"https://github.com/zendesk.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Migration Tools  [![Build Status](https://github.com/zendesk/migration_tools/workflows/CI/badge.svg)](https://github.com/zendesk/migration_tools/actions?query=workflow%3ACI)\n\nRake tasks for grouping migrations.\n\n## Groups\n\nThe migration tools allow you to specify a group in your migrations. This is used to allow you to run your migrations in groups, as opposed to all at once. This is useful if you want to run a certain group of migrations before a deploy, another group during deploy and a third group after deploy.\n\nWe use this technique to be able to QA new production code in an isolated environment that runs against the production database. It also reduces the number of moving parts come deploy time, which is helpful when you're doing zero downtime deploys.\n\nYou specify which group a migration belongs to inside the migration, like so:\n\n```ruby\n  class CreateHello \u003c ActiveRecord::Migration\n    group :before\n\n    def self.up\n      ...\n    end\n  end\n```\n\nThe names of the possible groups are predefined to avoid turning this solution in to a generic hammer from hell. You can use the following groups: before, during, after, change. We define these as:\n\n*before* this is for migrations that are safe to run before a deploy of new code, e.g. adding columns/tables\n\n*during* this is for migrations that require the data structure and code to deploy \"synchronously\"\n\n*after* this is for migrations that should run after the new code has been pushed and is running\n\n*change* this is a special group that you run whenever you want to change DB data which you'd otherwise do in script/console\n\n\n## Commands\n\nThe list commands\n\n```\n  $ rake db:migrate:list - shows pending migrations by group\n  $ rake db:migrate:list:before - shows pending migrations for the before group\n  $ rake db:migrate:list:during - shows pending migrations for the during group\n  $ rake db:migrate:list:after  - shows pending migrations for the after group\n  $ rake db:migrate:list:change - shows pending migrations for the change group\n```\n\nThe group commands\n\n```\n  $ GROUP=before rake db:migrate:group - runs the migrations in the specified group\n  $ rake db:migrate:group:before - runs pending migrations for the before group\n  $ rake db:migrate:group:during - runs pending migrations for the during group\n  $ rake db:migrate:group:after  - runs pending migrations for the after group\n  $ rake db:migrate:group:change - runs pending migrations for the change group\n```\nNote that rake db:migrate is entirely unaffected by this.\n\n## License\n\nCopyright 2015 Zendesk\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fmigration_tools","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzendesk%2Fmigration_tools","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzendesk%2Fmigration_tools/lists"}