Create database file and schema

Modification in register script
This commit is contained in:
German Correa 2017-12-01 13:58:33 -03:00
parent 518bd7d957
commit c2b63d6100
2 changed files with 46 additions and 0 deletions

46
db/db.php Normal file
View 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

Binary file not shown.