DBIx-Class-Migration icon indicating copy to clipboard operation
DBIx-Class-Migration copied to clipboard

How to use @ARGV instead "magic argv" param in the best way?

Open Mir-ina opened this issue 4 years ago • 0 comments

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?

Mir-ina avatar Oct 15 '20 04:10 Mir-ina