{"id":32171268,"url":"https://github.com/fresha/strong_migrations","last_synced_at":"2025-12-11T23:44:48.201Z","repository":{"id":40795365,"uuid":"422161515","full_name":"fresha/strong_migrations","owner":"fresha","description":"Catch unsafe migrations in your Elixir application","archived":false,"fork":false,"pushed_at":"2022-10-10T18:12:08.000Z","size":210,"stargazers_count":58,"open_issues_count":3,"forks_count":1,"subscribers_count":35,"default_branch":"master","last_synced_at":"2025-10-31T00:36:27.931Z","etag":null,"topics":["ecto","elixir","migrations"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fresha.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":"SECURITY.md","support":null}},"created_at":"2021-10-28T10:32:51.000Z","updated_at":"2025-05-05T13:33:14.000Z","dependencies_parsed_at":"2022-07-10T15:00:22.403Z","dependency_job_id":null,"html_url":"https://github.com/fresha/strong_migrations","commit_stats":null,"previous_names":["surgeventures/strong_migrations"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/fresha/strong_migrations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresha%2Fstrong_migrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresha%2Fstrong_migrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresha%2Fstrong_migrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresha%2Fstrong_migrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fresha","download_url":"https://codeload.github.com/fresha/strong_migrations/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fresha%2Fstrong_migrations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27672345,"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","status":"online","status_checked_at":"2025-12-11T02:00:11.302Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["ecto","elixir","migrations"],"created_at":"2025-10-21T17:46:37.984Z","updated_at":"2025-12-11T23:44:48.189Z","avatar_url":"https://github.com/fresha.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# StrongMigrations\n\n[![Build Status](https://github.com/surgeventures/strong_migrations/workflows/CI/badge.svg)](https://github.com/surgeventures/strong_migrations/actions)\n[![Module Version](https://img.shields.io/hexpm/v/strong_migrations.svg)](https://hex.pm/packages/strong_migrations)\n[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/strong_migrations/)\n[![Total Download](https://img.shields.io/hexpm/dt/strong_migrations.svg)](https://hex.pm/packages/strong_migrations)\n[![License](https://img.shields.io/hexpm/l/strong_migrations.svg)](https://github.com/surgeventures/strong_migrations/blob/master/LICENSE.md)\n[![Last Updated](https://img.shields.io/github/last-commit/surgeventures/strong_migrations.svg)](https://github.com/surgeventures/strong_migrations/commits/master)\n\n**Catch unsafe migrations in your Elixir application**\n\n## Table of Contents\n\n- [What is it?](#what-is-it)\n- [How to install?](#how-to-install)\n- [How to configure?](#how-to-configure)\n- [Similar packages](#similar-packages)\n\n## What is it\n\n`strong_migrations` is a library that protects your application from invoking unsafe migrations, they needs to be marked as a safe.\n\n1. Analyze migrations if they are safe.\n2. If migrations are unsafe -\u003e print errors.\n3. If migrations are safe -\u003e use `ecto.migrate`.\n\nYou can also use a macro of `StrongMigrations` like `safety_assured` to be sure it's safe and you can run migrations with specific changes. Example\n\n```elixir\ndefmodule SafetyAssuredDropTable do\n  @moduledoc false\n\n  use StrongMigrations\n\n  def change do\n    safety_assured do\n      drop(table(:users))\n    end\n  end\nend\n```\n\n![](asset/img/example.png)\n\n#### Features\n\n- checking if your migrations are adding an index concurrently in transaction\n- checking if your migrations are adding an index but not concurrently\n- checking if your migrations are removing an index concurrently in transaction\n- checking if your migrations are renaming columns (it's always better to remove old and add new column)\n- checking if your migrations are removing columns\n- checking if your migrations are removing tables\n- mark `safety assured do: drop table(:posts)` or multiline when you're sure it's safe\n- check if default is a function when altering a table\n  ... tbd\n\n## How to install\n\nThe package can be installed by adding `strong_migrations` to your list of dependencies in `mix.exs` as follows. Also, it's worth adding an alias like: `ecto.migrate -\u003e strong_migrations.migrate` and thanks to that you'll be sure that all migrations were checked before running.\n\nUpdate your `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:strong_migrations, \"~\u003e 0.1\"}\n  ]\nend\n```\n\nOptionally, you can add an alias:\n\n```elixir\n\"ecto.migrate\": \"strong_migrations.migrate\"\n```\n\nAnd, another option is to use `StrongMigrations` as a default for generated migrations. Just add following line to your `config.exs` file.\n\n```elixir\nconfig :ecto_sql, migration_module: StrongMigrations\n```\n\n## How to configure\n\nIf you want to specify which classifiers you want to use, please add to your `config.exs` following lines\n\n```elixir\nconfig :strong_migrations,\n  classifiers: [\n    StrongMigrations.Classifiers.AddIndexConcurrentlyInTransaction,\n    StrongMigrations.Classifiers.AddIndexNotConcurrently,\n    StrongMigrations.Classifiers.DropIndexConcurrentlyInTransaction,\n    StrongMigrations.Classifiers.DropTable,\n    StrongMigrations.Classifiers.RemoveColumn,\n    StrongMigrations.Classifiers.RenameColumn,\n    StrongMigrations.Classifiers.DefaultIsFunction\n  ]\n```\n\nIf you want to specify migration paths available in your project (not default -\u003e `priv/repo/migrations`), please add to your `config.exs` following lines\n\n```elixir\nconfig :strong_migrations,\n  migration_paths: [\n    \"priv/repo/migrations\",\n    \"apps/*/priv/repo/migrations\",\n    \"my/fancy/path/to/migrations\"\n  ],\n```\n\n## Similar Packages\n\n- https://github.com/ankane/strong_migrations (Ruby)\n- https://github.com/Artur-Sulej/excellent_migrations \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffresha%2Fstrong_migrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffresha%2Fstrong_migrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffresha%2Fstrong_migrations/lists"}