| 1 | package Mojolicious::Plugin::ORM::DBIx::Command::schema_load 0.02; | ||
| 2 | use v5.26; | ||
| 3 | use warnings; | ||
| 4 | |||
| 5 | =pod | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | (re)generate model classes from database schema | ||
| 10 | Usage: <APP> schema-load [--debug] [--[no]quiet] | ||
| 11 | |||
| 12 | Options: | ||
| 13 | --debug During load, print generated code to STDERR | ||
| 14 | Sets --quiet to off | ||
| 15 | --quiet Suppress "Dumping manual schema ... Schema dump completed" messages. | ||
| 16 | Default on, use --noquiet to turn off | ||
| 17 | |||
| 18 | =cut | ||
| 19 | |||
| 20 | use Mojo::Base 'Mojolicious::Command'; | ||
| 21 | use Getopt::Long qw(GetOptionsFromArray); | ||
| 22 | |||
| 23 | use experimental qw(signatures); | ||
| 24 | |||
| 25 | has description => '(re)generate model classes from database schema'; | ||
| 26 | has usage => sub ($self) {$self->extract_usage}; | ||
| 27 | |||
| 28 | sub run ($self, @args) { | ||
| 29 | my ($debug, $quiet) = (0, 1); | ||
| 30 | GetOptionsFromArray( | ||
| 31 | \@args, | ||
| 32 | debug => sub {$debug = 1; $quiet = 0}, | ||
| 33 | 'quiet!' => \$quiet, | ||
| 34 | ); | ||
| 35 | |||
| 36 | $self->app->run_schema_load($debug, $quiet); | ||
| 37 | } | ||
| 38 | |||
| 39 | =pod | ||
| 40 | |||
| 41 | =head1 AUTHOR | ||
| 42 | |||
| 43 | Mark Tyrrell C<< <mark@tyrrminal.dev> >> | ||
| 44 | |||
| 45 | =head1 LICENSE | ||
| 46 | |||
| 47 | Copyright (c) 2024 Mark Tyrrell | ||
| 48 | |||
| 49 | Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 50 | of this software and associated documentation files (the "Software"), to deal | ||
| 51 | in the Software without restriction, including without limitation the rights | ||
| 52 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 53 | copies of the Software, and to permit persons to whom the Software is | ||
| 54 | furnished to do so, subject to the following conditions: | ||
| 55 | |||
| 56 | The above copyright notice and this permission notice shall be included in all | ||
| 57 | copies or substantial portions of the Software. | ||
| 58 | |||
| 59 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 60 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 61 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 62 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 63 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 64 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 65 | SOFTWARE. | ||
| 66 | |||
| 67 | =cut | ||
| 68 | |||
| 69 | 1; | ||
| 70 | |||
| 71 | __END__ |