| 1 | package AproJo::Command::author_tool; | ||
| 2 | use Mojo::Base 'Mojolicious::Command'; | ||
| 3 | |||
| 4 | use DBIx::Class::DeploymentHandler; | ||
| 5 | |||
| 6 | sub run { | ||
| 7 | my $self = shift; | ||
| 8 | |||
| 9 | my $command = shift || 'generate_install_scripts'; | ||
| 10 | my $method = $self->can($command) or die "No command: $command\n"; | ||
| 11 | |||
| 12 | $self->$method(); | ||
| 13 | } | ||
| 14 | |||
| 15 | sub generate_install_scripts { | ||
| 16 | my $self = shift; | ||
| 17 | |||
| 18 | my $schema = $self->app->schema; | ||
| 19 | my $dh = DBIx::Class::DeploymentHandler->new( | ||
| 20 | { | ||
| 21 | schema => $schema, | ||
| 22 | databases => [], | ||
| 23 | script_directory => 'lib/AproJo/files/sql', | ||
| 24 | } | ||
| 25 | ); | ||
| 26 | my $version = $schema->schema_version; | ||
| 27 | |||
| 28 | say "generating deployment script"; | ||
| 29 | $dh->prepare_install; | ||
| 30 | |||
| 31 | } | ||
| 32 | |||
| 33 | 1; |