From 5bacbcec28632a3694a3c5405e60636148181207 Mon Sep 17 00:00:00 2001 From: Roan Horning Date: Sun, 3 Jul 2022 19:03:14 -0400 Subject: [PATCH] Add database creation helper scripts Add a script to create an empty database and a script to create a database filled with data from the Insert_Test_Data script. --- README.md | 3 +++ _sql/Create_Database_Empty.sql | 4 ++++ _sql/Create_Database_Test.sql | 2 ++ site-generator | 3 +++ 4 files changed, 12 insertions(+) create mode 100644 _sql/Create_Database_Empty.sql create mode 100644 _sql/Create_Database_Test.sql diff --git a/README.md b/README.md index cbfa7c5..30ea374 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,9 @@ Static web page generator for the Hacker Public Radio website. ## Installation * Clone or download this repository * Create the sqlite3 database from the files in the _sql directory. The default name for the database file is "hpr.db" and should be located in the root of the project directory. The name and location can be set in the site.cfg file. +* Two sql helper scripts are available to generate an empty database or a database filled with test data. + - For an empty database: `cat Create_Database_Empty.sql | sqlite3 hpr.db` + - For a database with test data: `cat Create_Database_Test.sql | sqlite3 hpr.db` * Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.) * GetOpt * Pod::Usage diff --git a/_sql/Create_Database_Empty.sql b/_sql/Create_Database_Empty.sql new file mode 100644 index 0000000..bc5c0a2 --- /dev/null +++ b/_sql/Create_Database_Empty.sql @@ -0,0 +1,4 @@ +.read Create_Table_Contributors.sql +.read Create_Table_Episodes.sql +.read Create_Table_Tags.sql +.read Create_Table_Tag_To_Episodes.sql diff --git a/_sql/Create_Database_Test.sql b/_sql/Create_Database_Test.sql new file mode 100644 index 0000000..3fe2efe --- /dev/null +++ b/_sql/Create_Database_Test.sql @@ -0,0 +1,2 @@ +.read Create_Database_Empty.sql +.read Insert_Test_Data.sql diff --git a/site-generator b/site-generator index da1351f..d433c65 100755 --- a/site-generator +++ b/site-generator @@ -32,6 +32,9 @@ This is a site generator for the Hacker Public Radio website based upon the Perl * Create the sqlite3 database from the files in the _sql directory. The default name for the database file is "hpr.db" and should be located in the root of the project directory. The name and location can be set in the site.cfg file. + * Two sql helper scripts are available to generate an empty database or a database filled with test data. + - For an empty database: `cat Create_Database_Empty.sql | sqlite3 hpr.db` + - For a database with test data: `cat Create_Database_Test.sql | sqlite3 hpr.db` * Install the needed Perl modules using preferred method (distribution packages, CPAN, etc.) * GetOpt * Pod::Usage