diff --git a/Netdisco/bin/netdisco-db-deploy b/Netdisco/bin/netdisco-db-deploy index 6f942a5a..1ee5b8e1 100755 --- a/Netdisco/bin/netdisco-db-deploy +++ b/Netdisco/bin/netdisco-db-deploy @@ -6,6 +6,10 @@ use warnings FATAL => 'all'; use Dancer ':script'; use Dancer::Plugin::DBIC 'schema'; +use 5.10.0; +use Term::UI; +use Term::ReadLine; + use HTTP::Tiny; use Try::Tiny; @@ -18,15 +22,15 @@ user with rights to create tables in that database. Both the table and user name must match those configured in your environment YAML file (default C). +Additionally this script will download the latest MAC address vendor prefix +data from the Internet, and update the OUI table in the database. Hence +Internet access is required to run the script. + Simply run this script, which connects to the database and runs without user interaction. If there's no Nedisco schema, it is deployed. If there's an unversioned schema then versioning is added, and updates applied. Otherwise only necessary updates are applied to an already versioned schema. -Additionally this script will download the latest MAC address vendor prefix -data from the Internet, and update the OUI table in the database. Hence -Internet access is required to run the script. - =head2 Versions =over 4 @@ -51,6 +55,20 @@ Version 4 (not yet created) B =cut +say 'The following must be in place:'; +say ' * Internet access'; +say ' * Database added to PostgreSQL for Netdisco'; +say ' * User added to PostgreSQL with rights to the Database'; +say ' * "environments/development.yml" file configured with Database dsn/user/pass'; +say ''; + +my $term = Term::ReadLine->new('netdisco'); +my $bool = $term->ask_yn( + prompt => 'Ready to deploy?', default => 'n', +); + +exit(0) unless $bool; + my $schema = schema('netdisco'); # installs the dbix_class_schema_versions table with version "1"