From 4e5e8bf507be75facfd1274b2288d137764e63bc Mon Sep 17 00:00:00 2001 From: Calvin Morrison Date: Thu, 27 Jul 2023 21:04:27 -0400 Subject: start working n the db side of detecting. --- migrate.php | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) (limited to 'migrate.php') diff --git a/migrate.php b/migrate.php index 3120a75..0172330 100644 --- a/migrate.php +++ b/migrate.php @@ -1,18 +1,46 @@ query($query)) { + if($res->num_rows == 0) { + print("no database found\n"); + if(readline("No database exists. Do want us to create it? (Y) ") != "Y") { + abort(); + } + } +} + +// connect to DB. +$con->select_db($config['database']); + +// group all ver $line = fgets(STDIN); if(!preg_match("/^# Versioned Migration Script$/", $line)) { die("Sorry, this doesn't look like a versioned file.\n"); } + // find current version. -- cgit v1.2.3