Skip to content

Commit d06c521

Browse files
committed
database creation for storage
1 parent 9f576d2 commit d06c521

1 file changed

Lines changed: 21 additions & 1 deletion

File tree

init.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,26 @@ function initDatabase() {
5858
echo $e->getMessage();
5959
}
6060
}
61-
61+
62+
function initStorageDatabase() {
63+
$statements = [
64+
'CREATE TABLE IF NOT EXISTS storage (
65+
storage_id VARCHAR(255) NOT NULL PRIMARY KEY,
66+
owner VARCHAR(255) NOT NULL
67+
)'
68+
];
69+
70+
try {
71+
$pdo = new \PDO("sqlite:" . DBPATH);
72+
73+
// create tables
74+
foreach($statements as $statement){
75+
$pdo->exec($statement);
76+
}
77+
} catch(\PDOException $e) {
78+
echo $e->getMessage();
79+
}
80+
}
6281
initKeys();
6382
initDatabase();
83+
initStorageDatabase();

0 commit comments

Comments
 (0)