Move database creation to bin/dbcreate.pl.

Remove install/*

Signed-off-by: Thomas Hochstein <thh@thh.name>
This commit is contained in:
Thomas Hochstein 2025-05-18 13:33:49 +02:00
parent 4ad63fcb4e
commit 9b6bf3e194
3 changed files with 12 additions and 10 deletions

View file

@ -1,6 +1,6 @@
#! /usr/bin/perl #! /usr/bin/perl
# #
# install.pl # dbcreate.pl
# #
# This script will create database tables as necessary. # This script will create database tables as necessary.
# #
@ -13,7 +13,7 @@
BEGIN { BEGIN {
use File::Basename; use File::Basename;
# we're in .../install, so our module is in ../lib # we're in .../bin, so our module is in ../lib
push(@INC, dirname($0).'/../lib'); push(@INC, dirname($0).'/../lib');
} }
use strict; use strict;
@ -231,7 +231,7 @@ sub CreateTable {
}; };
my $DBQuery = $DBHandle->prepare($DBCreate{$Table}); my $DBQuery = $DBHandle->prepare($DBCreate{$Table});
$DBQuery->execute() or $DBQuery->execute() or
&Bleat(2, sprintf("Can't create table %s in database %s: %s%\n",$Table, &Bleat(2, sprintf("Can't create table %s in database %s: %s\n",$Table,
$Conf{'DBDatabase'},$DBI::errstr)); $Conf{'DBDatabase'},$DBI::errstr));
printf("Database table %s.%s created succesfully.\n", printf("Database table %s.%s created succesfully.\n",
$Conf{'DBDatabase'},$Conf{$Table}); $Conf{'DBDatabase'},$Conf{$Table});
@ -261,11 +261,11 @@ __END__
=head1 NAME =head1 NAME
install - installation script dbcreate - database creation script
=head1 SYNOPSIS =head1 SYNOPSIS
B<install> [B<-Vh> [--update I<version>] [B<--conffile> I<filename>] B<dbcreate> [B<-Vh> [--update I<version>] [B<--conffile> I<filename>]
=head1 REQUIREMENTS =head1 REQUIREMENTS
@ -273,11 +273,12 @@ See L<doc/README>.
=head1 DESCRIPTION =head1 DESCRIPTION
This script will create database tables as necessary and configured. This script will create a database and database tables as necessary
and configured.
=head2 Configuration =head2 Configuration
B<install> will read its configuration from F<newsstats.conf> which should B<dbcreate> will read its configuration from F<newsstats.conf> which should
be present in etc/ via Config::Auto or from a configuration file submitted be present in etc/ via Config::Auto or from a configuration file submitted
by the B<--conffile> option. by the B<--conffile> option.
@ -309,7 +310,7 @@ Load configuration from I<filename> instead of F<newsstats.conf>.
=over 4 =over 4
=item F<install/install.pl> =item F<bin/dbcreate.pl>
The script itself. The script itself.

View file

@ -20,6 +20,7 @@ NewsStats 0.3.0 (unreleased)
Change caption handling, update documentation accordingly. Change caption handling, update documentation accordingly.
* Fix call to GetMaxLength() in cliservstats. * Fix call to GetMaxLength() in cliservstats.
* Fix typos in documentation, update sample config file. * Fix typos in documentation, update sample config file.
* Move database creation from install/install.pl to bin/dbcreate.pl
NewsStats 0.2.0 (2025-05-10) NewsStats 0.2.0 (2025-05-10)
* Redo directory structure: * Redo directory structure:

View file

@ -70,9 +70,9 @@ INSTALLATION INSTRUCTIONS
* Setup your database server with a username, password and * Setup your database server with a username, password and
database matching the NewsStats configuration (see 2 a). database matching the NewsStats configuration (see 2 a).
* Start the installation script: * Start the database creation script:
# install/install.pl # bin/dbcreate.pl
It will setup the necessary database tables and display some It will setup the necessary database tables and display some
information on the next steps. information on the next steps.