Ejemplo n.º 1
0
 def test_move__root(self, scripts_dir):
     home = MigrationHome(scripts_dir)
     home.move("aaaaaa")
     assert home.generate_dependency_graph() == {
         "bbbbbb": {None},
         "cccccc": {"bbbbbb"},
         "dddddd": {"bbbbbb"},
         "eeeeee": {"cccccc", "dddddd"},
         "ffffff": {"dddddd"},
         "gggggg": {"eeeeee", "ffffff"},
         "aaaaaa": {"gggggg"},
     }
Ejemplo n.º 2
0
 def test_move__multiple_new_base(self, scripts_dir):
     home = MigrationHome(scripts_dir)
     home.move("eeeeee", "ffffff", "dddddd")
     assert home.generate_dependency_graph() == {
         "aaaaaa": {None},
         "bbbbbb": {"aaaaaa"},
         "cccccc": {"bbbbbb"},
         "dddddd": {"bbbbbb"},
         "ffffff": {"dddddd"},
         "gggggg": {"ffffff", "cccccc", "dddddd"},
         "eeeeee": {"ffffff", "dddddd"},
     }
Ejemplo n.º 3
0
def move(
    revision: str = typer.Argument(
        ...,
        help="The revision hash to be moved",
    ),
    new_bases: typing.List[str] = typer.Argument(
        ...,
        help="The new base(s) to base the revision upon",
    ),
    alembic_home_dir: pathlib.Path = typer.Option(
        "etc/alembic/versions",
        exists=True,
        help="The directory where the alembic migrations live",
    ),
):
    home = MigrationHome(alembic_home_dir)
    home.move(revision, *new_bases)