From de6f5e2be5dfbd2c55dd689439f46363649ae747 Mon Sep 17 00:00:00 2001 From: Thedro Neely Date: Fri, 18 Nov 2022 17:04:50 -0500 Subject: bootstrap/database/Connection: Swap to sqlite --- .gitignore | 8 ++++---- Makefile | 3 ++- bootstrap/database/Connection.php | 8 ++++---- config.php | 9 ++++----- 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index 05ddf83..9029cc3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,10 +1,10 @@ .hugo_build.lock /bootstrap/comments/comments +/database +/generators/hugo/public +/production /public/posts +/staging /vendor config.php -database -generators/hugo/public google[a-z0-9]*.html -production -staging diff --git a/Makefile b/Makefile index 761bd96..f64cbd6 100644 --- a/Makefile +++ b/Makefile @@ -32,8 +32,9 @@ deploy: ln --symbolic --force '$(path)/public' '$(prelaunch)' make minify make cache - cd '$(deployment)' && make site && make migration + cd '$(deployment)' && make site make permissions + cd '$(deployment)' && make migration mv --force --no-target-directory '$(prelaunch)' '$(public)' find '$(target)' -maxdepth 1 ! -path '$(target)' -type d -printf '%T@\t%p\n' \ | sort --reverse --general-numeric-sort --field-separator $$'\t' \ diff --git a/bootstrap/database/Connection.php b/bootstrap/database/Connection.php index deec2c6..3093d85 100644 --- a/bootstrap/database/Connection.php +++ b/bootstrap/database/Connection.php @@ -2,17 +2,17 @@ class Connection { - public static function make($config) + public static function make(array $config) { try { return new PDO( - $config['connection'].';dbname='.$config['name'], + $config['dsn'], $config['username'], $config['password'], $config['options'] ); - } catch (PDOException $e) { - error_log($e->getMessage()); + } catch (PDOException $error) { + error_log($error->getMessage()); } } } diff --git a/config.php b/config.php index 0e83ebe..5df7b42 100644 --- a/config.php +++ b/config.php @@ -2,10 +2,9 @@ return [ 'database' => [ - 'name' => 'pgsql_database', - 'username' => 'pgsql_username', - 'password' => 'pgsql_password', - 'connection' => 'pgsql:', + 'dsn' => 'sql:;dbname=sql_database', + 'username' => 'sql_username', + 'password' => 'sql_password', 'options' => [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ] @@ -17,5 +16,5 @@ return [ 'name' => 'email_name', 'username' => 'email_username', 'password' => 'email_password', - ] + ], ]; -- cgit v1.2.3