Skip to content

Merge command hints to do a slice, but there is no option for this #1712

@CaselIT

Description

@CaselIT

if it were me looking at this, I'd say the only problem is that merge is outputting that particular error message which comes from the "create a revision" mechanics and it should be reworded in that codepath to say "this is not supported by merge". without looking into potential use cases here.

but then you are saying you wrote it all out as rev ids manually and "alembic is good enough"....which implies you're actually looking to make a merge point that adds a new head, rather than resolving two existing heads, and that....is beyond what I'd understand is actually useful in real world scenarios. github is having an outage so I cant search for if there was an issue to add --splice to merge. but at the same time it looks like --splice just disables a certain check from happening. But overall I dont know what happens if you tell it to make a new revision with multiple bases and those bases aren't heads, I guess it just does it? Here's the patch, it wont hurt on this end since it's nothing so feel free to try

diff --git a/alembic/command.py b/alembic/command.py
index 8e48547..ff9b159 100644
--- a/alembic/command.py
+++ b/alembic/command.py
@@ -385,6 +385,7 @@ def merge(
     message: Optional[str] = None,
     branch_label: Optional[_RevIdType] = None,
     rev_id: Optional[str] = None,
+    splice: bool = False,
 ) -> Optional[Script]:
     """Merge two revisions together.  Creates a new migration file.
 
@@ -435,6 +436,7 @@ def merge(
         refresh=True,
         head=revisions,
         branch_labels=branch_label,
+        splice=splice,
         **template_args,  # type:ignore[arg-type]
     )

Originally posted by @zzzeek in #1707 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions