@@ -53,6 +53,13 @@ pub(crate) enum MigrationApply {
5353 } ,
5454}
5555
56+ #[ derive( Debug ) ]
57+ pub ( crate ) enum HistoryCommand {
58+ Sync ,
59+ Fix ,
60+ }
61+
62+
5663#[ derive( Debug ) ]
5764pub ( crate ) enum MigrationCommand {
5865 Init ,
@@ -70,8 +77,7 @@ pub(crate) enum MigrationCommand {
7077 } ,
7178 Apply ( MigrationApply ) ,
7279 List ,
73- Sync ,
74- Fix ,
80+ History ( HistoryCommand ) ,
7581 Diff ,
7682}
7783
@@ -183,12 +189,17 @@ impl ClapArgumentLoader {
183189 . about ( "Lists all applied migrations." ) ,
184190 )
185191 . subcommand (
186- clap:: Command :: new ( "sync" )
187- . about ( "Upserts all remote migrations locally." ) ,
188- )
189- . subcommand (
190- clap:: Command :: new ( "fix" )
191- . about ( "Shuffles all non-run local migrations to the end of the chain." ) ,
192+ clap:: Command :: new ( "history" )
193+ . about ( "Manages migration history." )
194+ . subcommand_required ( true )
195+ . subcommand (
196+ clap:: Command :: new ( "sync" )
197+ . about ( "Upserts all remote migrations locally." ) ,
198+ )
199+ . subcommand (
200+ clap:: Command :: new ( "fix" )
201+ . about ( "Shuffles all non-run local migrations to the end of the chain." ) ,
202+ ) ,
192203 )
193204 . subcommand (
194205 clap:: Command :: new ( "diff" )
@@ -263,10 +274,15 @@ impl ClapArgumentLoader {
263274 }
264275 } else if let Some ( _) = subc. subcommand_matches ( "list" ) {
265276 MigrationCommand :: List
266- } else if let Some ( _) = subc. subcommand_matches ( "sync" ) {
267- MigrationCommand :: Sync
268- } else if let Some ( _) = subc. subcommand_matches ( "fix" ) {
269- MigrationCommand :: Fix
277+ } else if let Some ( history_subc) = subc. subcommand_matches ( "history" ) {
278+ let history_cmd = if let Some ( _) = history_subc. subcommand_matches ( "sync" ) {
279+ HistoryCommand :: Sync
280+ } else if let Some ( _) = history_subc. subcommand_matches ( "fix" ) {
281+ HistoryCommand :: Fix
282+ } else {
283+ unreachable ! ( ) ;
284+ } ;
285+ MigrationCommand :: History ( history_cmd)
270286 } else if let Some ( _) = subc. subcommand_matches ( "diff" ) {
271287 MigrationCommand :: Diff
272288 } else if let Some ( apply_subc) = subc. subcommand_matches ( "apply" ) {
0 commit comments