diff --git a/dev_mvc/tests/createdb/index.php b/dev_mvc/tests/createdb/index.php index 8728f93..20d0244 100644 --- a/dev_mvc/tests/createdb/index.php +++ b/dev_mvc/tests/createdb/index.php @@ -21,4 +21,59 @@ $db="webforum"; } catch (PDOException $e) { die("DB ERROR: ". $e->getMessage()); } + + try { + $dsn = "mysql:host=$host;dbname=$db"; + //Maak verbinding + $con = new PDO($dsn, $user, $pass); + $con->exec("CREATE TABLE `board` ( + `ID` int(16) NOT NULL AUTO_INCREMENT, + `name` varchar(256) NOT NULL, + `description` text NOT NULL, + `permLevel` int(16) NOT NULL DEFAULT '0', + PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1"); + $con->exec("CREATE TABLE `email_activation_keys` ( + `id` int(16) NOT NULL AUTO_INCREMENT, + `users_id` int(16) NOT NULL, + `activationkey` varchar(256) NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1"); + $con->exec("CREATE TABLE `reply` ( + `ID` int(16) NOT NULL AUTO_INCREMENT, + `thread_ID` int(16) NOT NULL, + `users_ID` int(16) NOT NULL, + `content` text NOT NULL, + `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1"); + $con->exec("CREATE TABLE `thread` ( + `ID` int(16) NOT NULL AUTO_INCREMENT, + `users_ID` int(16) NOT NULL, + `board_ID` int(16) NOT NULL, + `title` varchar(256) NOT NULL, + `text` text NOT NULL, + `date_created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1"); + $con->exec("CREATE TABLE `users` ( + `ID` int(11) NOT NULL AUTO_INCREMENT, + `username` varchar(256) NOT NULL, + `email` varchar(256) NOT NULL, + `password` varchar(256) NOT NULL, + `reg_date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, + `login_date` datetime NOT NULL, + `reg_ip` varchar(256) NOT NULL, + `permissions` int(11) NOT NULL DEFAULT '-1', + `active` tinyint(1) DEFAULT '0', + PRIMARY KEY (`ID`) ) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1"); + $con->exec("CREATE TABLE `usersessions` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `uid` int(11) NOT NULL, + `token` varchar(256) NOT NULL, + `expires` datetime NOT NULL, + PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1"); + } + catch (PDOException $e) { + die("DB ERROR: ". $e->getMessage()); + } + + + ?> \ No newline at end of file