2020-03-14 03:05:28 +01:00
|
|
|
CREATE DATABASE friendsbook;
|
|
|
|
|
|
|
|
USE friendsbook;
|
|
|
|
|
|
|
|
CREATE TABLE `user` (
|
|
|
|
`ID` INT NOT NULL AUTO_INCREMENT,
|
2020-03-14 19:50:49 +01:00
|
|
|
`username` VARCHAR(50) NOT NULL DEFAULT '0',
|
2020-03-14 03:05:28 +01:00
|
|
|
`email` VARCHAR(100) NOT NULL DEFAULT '0',
|
|
|
|
`password` VARCHAR(100) NOT NULL DEFAULT '0',
|
|
|
|
PRIMARY KEY (`ID`),
|
2020-03-14 19:50:49 +01:00
|
|
|
UNIQUE INDEX `user`(`username`)
|
|
|
|
) ENGINE = InnoDB;
|
|
|
|
|
|
|
|
CREATE TABLE `tans` (
|
|
|
|
`id` INT NOT NULL AUTO_INCREMENT,
|
|
|
|
`userID` INT NOT NULL,
|
|
|
|
`tan` VARCHAR(13) NOT NULL,
|
|
|
|
`used` BOOLEAN NOT NULL,
|
|
|
|
PRIMARY KEY (`id`),
|
|
|
|
FOREIGN KEY (`userID`) REFERENCES `user`(`ID`) ON DELETE CASCADE ON UPDATE CASCADE
|
2020-03-14 03:05:28 +01:00
|
|
|
) ENGINE = InnoDB;
|
|
|
|
|
|
|
|
CREATE TABLE `entries` (
|
2018-06-11 17:56:22 +02:00
|
|
|
`id` INT NOT NULL AUTO_INCREMENT ,
|
2018-06-11 17:44:54 +02:00
|
|
|
`userID` INT NOT NULL ,
|
|
|
|
`tanID` INT NOT NULL ,
|
|
|
|
`vorname` LONGTEXT NOT NULL ,
|
|
|
|
`nachname` LONGTEXT NOT NULL ,
|
2018-06-17 22:23:11 +02:00
|
|
|
`geburtstag` LONGTEXT DEFAULT NULL ,
|
|
|
|
`wohnort` LONGTEXT DEFAULT NULL ,
|
|
|
|
`strasse` LONGTEXT DEFAULT NULL ,
|
2018-06-11 17:44:54 +02:00
|
|
|
`kennenUns` LONGTEXT NOT NULL ,
|
2018-06-17 22:23:11 +02:00
|
|
|
`festnetz` LONGTEXT DEFAULT NULL ,
|
|
|
|
`handynummer` LONGTEXT DEFAULT NULL ,
|
2018-06-11 17:44:54 +02:00
|
|
|
`email` LONGTEXT NOT NULL ,
|
2018-06-17 22:23:11 +02:00
|
|
|
`hobbies` LONGTEXT DEFAULT NULL ,
|
|
|
|
`berufswunsch` LONGTEXT DEFAULT NULL ,
|
|
|
|
`essen` LONGTEXT DEFAULT NULL ,
|
|
|
|
`insel` LONGTEXT DEFAULT NULL ,
|
|
|
|
`film` LONGTEXT DEFAULT NULL ,
|
|
|
|
`sport` LONGTEXT DEFAULT NULL ,
|
|
|
|
`charakter` LONGTEXT DEFAULT NULL ,
|
|
|
|
`tier` LONGTEXT DEFAULT NULL ,
|
|
|
|
`musik` LONGTEXT DEFAULT NULL ,
|
|
|
|
`game` LONGTEXT DEFAULT NULL ,
|
|
|
|
`alk` LONGTEXT DEFAULT NULL ,
|
|
|
|
`story` LONGTEXT DEFAULT NULL ,
|
|
|
|
`absturz` LONGTEXT DEFAULT NULL ,
|
|
|
|
`trinkspiel` LONGTEXT DEFAULT NULL ,
|
2018-06-11 17:56:22 +02:00
|
|
|
PRIMARY KEY (`id`),
|
2020-03-14 03:05:28 +01:00
|
|
|
UNIQUE (`tanID`),
|
|
|
|
FOREIGN KEY (`userID`) REFERENCES `user`(`ID`) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
FOREIGN KEY (`tanID`) REFERENCES `tans`(`id`) ON DELETE CASCADE ON UPDATE CASCADE
|
|
|
|
) ENGINE = InnoDB;
|