diff --git a/ci/.drone.yml b/ci/.drone.yml index 7885e92..8a28ad7 100644 --- a/ci/.drone.yml +++ b/ci/.drone.yml @@ -49,5 +49,3 @@ steps: - chmod 0600 ~/.ssh - chmod 0500 ~/.ssh/id_rsa* - rsync -avz -e "ssh -p 80 -o 'StrictHostKeyChecking=no'" --delete /outputs/* iqball@maxou.dev:/server/nginx/IQBall/$DRONE_BRANCH - - - - echo "cd /server/nginx/IQBall/$DRONE_BRANCH && chmod 777 . sql" | ssh -p 80 -o 'StrictHostKeyChecking=no' iqball@maxou.dev '/usr/bin/bash' \ No newline at end of file diff --git a/front/views/DisplayResults.tsx b/front/views/DisplayResults.tsx index d6a88db..c4bbd1b 100644 --- a/front/views/DisplayResults.tsx +++ b/front/views/DisplayResults.tsx @@ -1,7 +1,11 @@ +interface DisplayResultsProps { + results: readonly { name: string, description: string}[] +} -export default function DisplayResults({results}: { results: { name: string, description: string }[] }) { - const list = results.map(({name, description}) => +export default function DisplayResults({results}: DisplayResultsProps) { + const list = results + .map(({name, description}) =>
username: {name}
description: {description}
diff --git a/front/views/SampleForm.tsx b/front/views/SampleForm.tsx index c8f1ca4..604e362 100644 --- a/front/views/SampleForm.tsx +++ b/front/views/SampleForm.tsx @@ -1,5 +1,4 @@ -import React from "react"; -import ReactDOM from "react-dom/client"; + export default function SampleForm() { return ( diff --git a/sql/database.php b/sql/database.php index 0830ed8..6fae3ea 100644 --- a/sql/database.php +++ b/sql/database.php @@ -6,10 +6,10 @@ function get_database(): PDO { // defined by profiles. global $data_source_name; - // The presence of the .guard file says that the database has already been initialized. - $database_exists = file_exists(__DIR__ . "/.guard"); $pdo = new PDO($data_source_name, DATABASE_USER, DATABASE_PASSWORD); + $database_exists = $pdo->query("SELECT COUNT(*) FROM sqlite_master WHERE type = 'table'")->fetchColumn() > 0; + if ($database_exists) { return $pdo; } @@ -18,19 +18,10 @@ function get_database(): PDO { if (preg_match("/.*\.sql$/i", $file)) { $content = file_get_contents(__DIR__ . "/" . $file); - foreach (preg_split("/;\s*/", $content) as $req) { - if ($req === "") - break; - $pdo->query($req); - } + $pdo->exec($content); } } - //FIXME Server will need to explicitly set permissions to the `sql` folder - // in order for the touch to work - // - // Workaround in CI by setting permissions to 777 to the folder - touch(__DIR__ . "/.guard"); return $pdo; }