Q1
This commit is contained in:
parent
28a6b3ca28
commit
9b7d97bcbe
10
db/migrations/001_create_users_table.sql
Normal file
10
db/migrations/001_create_users_table.sql
Normal file
@ -0,0 +1,10 @@
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||
name VARCHAR(255) NOT NULL,
|
||||
email VARCHAR(255) NOT NULL UNIQUE,
|
||||
affiliation VARCHAR(255),
|
||||
expertise TEXT,
|
||||
orcid VARCHAR(255),
|
||||
password VARCHAR(255) NOT NULL, -- For simplicity, will store as plaintext for now
|
||||
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
11
setup.php
Normal file
11
setup.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
require_once 'db/config.php';
|
||||
|
||||
try {
|
||||
$pdo = db();
|
||||
$sql = file_get_contents('db/migrations/001_create_users_table.sql');
|
||||
$pdo->exec($sql);
|
||||
echo "Database setup successful.";
|
||||
} catch (PDOException $e) {
|
||||
die("Database setup failed: " . $e->getMessage());
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user