From 02608271bb2a9f3a65ed536984d306ee14b48e34 Mon Sep 17 00:00:00 2001 From: Geo Halkiadakis Date: Sun, 12 Jul 2026 15:51:52 +0300 Subject: initialize repository; add docker config; migrate configuration to new specs --- public/config/init-setup-db.php | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 public/config/init-setup-db.php (limited to 'public/config/init-setup-db.php') diff --git a/public/config/init-setup-db.php b/public/config/init-setup-db.php new file mode 100644 index 0000000..848d878 --- /dev/null +++ b/public/config/init-setup-db.php @@ -0,0 +1,66 @@ +connect_errno) { + echo "Database connection failed; Please try in a few minutes. "; + if (TESTING) echo $_dbc->connect_error; + $_dbc->close(); die(); +} +$_dbc->set_charset("utf8"); + +// parse behaviour ($_GET) arguments +// +// BUILD indexing tables for all ccodes +foreach ($ccodeARRAY as $key => $val) { + + $_Table = "tt_". $val->idx; + + $_stm = $_dbc->prepare("DROP TABLE IF EXISTS {$_Table}"); + $_stm->execute(); // execute query + $_stm->close(); + + // prepare statemet + $_stm = $_dbc->prepare("CREATE TABLE {$_Table} LIKE template"); + $_stm->execute(); // execute query + $_stm->close(); + + // Should you re-index tables? run the following + + // INSERT INTO {$_Table} (id) SELECT id FROM items WHERE ccode = ? ORDER BY id + +} + +echo "Tables are ready"; -- cgit v1.2.3