DBIx-Class-Migration
DBIx-Class-Migration copied to clipboard
How to use @ARGV instead "magic argv" param in the best way?
It is a question about commit 31395a9a743d303850be92ad38a2fe5ece0427f3 (HEAD) Date: Thu Mar 14 19:33:27 2019 +0000
I have a stable script for manipulation with DB versions. It has a user menu (Term::Menu) and it is wrote in this style for run user choice:
if ( $answer eq 'status' ) { DBIx::Class::Migration::Script->run_with_options( schema => Tsystem->model('TsystemDB')->schema, argv => ['status'] ); } elsif ( $answer eq 'prepare' ) { DBIx::Class::Migration::Script->run_with_options( schema => Tsystem->model('TsystemDB')->schema, argv => ['-O', 'prepare'] ); } elsif ( $answer eq 'install' ) { my $version = $prompt->question("Which version to install? "); if ( eval $version ) { DBIx::Class::Migration::Script->run_with_options( schema => Tsystem->model('TsystemDB')->schema, argv => ['install', '--to_version', $version] ); } else { DBIx::Class::Migration::Script->run_with_options( schema => Tsystem->model('TsystemDB')->schema, argv => ['install'] ); } } elsif ( $answer eq 'upgrade' ) { my $version = $prompt->question("Which version upgrade to? "); if ( eval $version ) { DBIx::Class::Migration::Script->run_with_options( schema => Tsystem->model('TsystemDB')->schema, argv => ['upgrade', '--to_version', $version] ); } else { DBIx::Class::Migration::Script->run_with_options( schema => Tsystem->model('TsystemDB')->schema, argv => ['upgrade'] ); } } elsif ( $answer eq 'downgrade' ) { ............
How can I modify my script for new version DBIx::Class::Migration::Script the best way?