Compare commits

...

2 Commits

Author SHA1 Message Date
barnold 1749e2b1c1 Load more records, but not some odd "No title" records. 2022-10-12 19:10:07 +01:00
barnold 847da3ba3b Update INSTALL. 2022-10-12 16:43:01 +01:00
3 changed files with 26 additions and 8 deletions

28
INSTALL
View File

@ -1,4 +1,19 @@
0. Preliminary configuration for postgresql
0. Dependencies
These are required for loading the catalog data.
postgresql-13
libdbd-csv-perl
libdbd-pg-perl
For the perl modules,
libdbix-class-perl
libdbix-class-schema-loader-perl
libtest2-suite-perl
libdatetime-format-pg-perl
1. Preliminary configuration for postgresql
These are one-time things to do, in that you can recreate and reload
the catalog database any number of times without having to do these
@ -34,12 +49,13 @@ Tell postgres about these edits.
At this point "irulan" has privilege to create and drop the catalog
database. Routine use of the database is more safely done by a
username with lesser privilege, i.e. only the "pgc_user" role. E.g.
as postgres, run
$ psql
postgres=# grant pgc_user to fenring;
postgres=# \q
1. As the operating system user "irulan", you should now be able to
2. As the operating system user "irulan", you should now be able to
use any of the targets in Makefile.orig to create and load the catalog
database.
@ -51,18 +67,18 @@ with e.g.
$ prove -l
2. To install the perl modules, run (for example)
3. To install the perl modules, run (for example)
perl Makefile.PL INSTALL_BASE=~/.local
make test
make install
3. To use these modules from your program, assuming the INSTALL_BASE
4. To use these modules from your program, assuming the INSTALL_BASE
suggested above,
declare -x PERL5LIB="$HOME/.local/lib/perl5"
and run your program (e.g. mojo-tutorial,
<https://tildegit.org/barnold/mojo-tutorial>).
and run your program (e.g. pgc-www,
<https://tildegit.org/barnold/pgc-www>).
<barnold@tilde.club>

View File

@ -106,9 +106,11 @@ while (my $row = $sth_csv->fetchrow_arrayref) {
next if (1 == $rowcount); # It ignores skip_first_row so DIY.
my ($pgid, $title, $auth) = @$row;
# Discard what we deem excessively long.
if (length($title) > 128 || length($auth) > 64) {
if (length($title) > 128 || length($auth) > 128) {
next;
}
# Discard the weird 'No title' records.
next if ($title eq 'No title');
# Some titles contain a newline. Turn occurrences of one or more
# whitespace characters into a single space.
$title =~ s/\s+/ /g;

View File

@ -1,7 +1,7 @@
CREATE TABLE author
( id INTEGER PRIMARY KEY GENERATED ALWAYS AS IDENTITY,
when_created TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
name VARCHAR(64) NOT NULL CONSTRAINT author_name_unique UNIQUE
name VARCHAR(128) NOT NULL CONSTRAINT author_name_unique UNIQUE
);
CREATE TABLE book