Create database file and schema
Modification in register script
This commit is contained in:
parent
518bd7d957
commit
c2b63d6100
46
db/db.php
Normal file
46
db/db.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
class DB extends SQLite3{
|
||||
function __construct(){
|
||||
$this->open('./ggdworkshop.db');
|
||||
}
|
||||
function schema(){
|
||||
$sql =<<<EOF
|
||||
CREATE TABLE IF NOT EXISTS Registro
|
||||
(
|
||||
id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||
nombre VARCHAR(50) NOT NULL,
|
||||
apellido VARCHAR(50) NOT NULL,
|
||||
titulo VARCHAR(50),
|
||||
afiliacion VARCHAR(50),
|
||||
ciudad VARCHAR(50),
|
||||
pais VARCHAR(50),
|
||||
email VARCHAR(80) NOT NULL UNIQUE,
|
||||
fechaLlegada DATE,
|
||||
fechaPartida DATE,
|
||||
financiacion BOOLEAN NOT NULL,
|
||||
invitado BOOLEAN NOT NULL,
|
||||
cartaInvitacion BOOELAN NOT NULL,
|
||||
roomingPref VARCHAR(50),
|
||||
roommate VARCHAR(50),
|
||||
fechaRegistro DATETIME NOT NULL
|
||||
);
|
||||
EOF;
|
||||
$ret = $this->exec($sql);
|
||||
if(!$ret){
|
||||
echo $this->lastErrorMsg();
|
||||
} else {
|
||||
echo "Schema created successfully\n";
|
||||
}
|
||||
$this->close();
|
||||
}
|
||||
}
|
||||
|
||||
$db = new DB();
|
||||
if(!$db){
|
||||
echo $db->lastErrorMsg();
|
||||
}else{
|
||||
echo "Opened database successfully\n";
|
||||
}
|
||||
$db->schema();
|
||||
?>
|
||||
|
BIN
db/ggdworkshop.db
Normal file
BIN
db/ggdworkshop.db
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user