update database

This commit is contained in:
osaajani 2019-11-11 00:21:40 +01:00
parent cf3553fef0
commit 32ef6b7c90
1 changed files with 14 additions and 15 deletions

View File

@ -3,6 +3,17 @@
CREATE DATABASE IF NOT EXISTS raspisms; CREATE DATABASE IF NOT EXISTS raspisms;
USE raspisms; USE raspisms;
CREATE TABLE IF NOT EXISTS user
(
id INT NOT NULL AUTO_INCREMENT,
email VARCHAR(150) NOT NULL,
password VARCHAR(255) NOT NULL,
admin BOOLEAN NOT NULL DEFAULT FALSE,
transfer BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (id),
UNIQUE (email)
);
CREATE TABLE IF NOT EXISTS setting CREATE TABLE IF NOT EXISTS setting
( (
id INT NOT NULL AUTO_INCREMENT, id INT NOT NULL AUTO_INCREMENT,
@ -133,24 +144,13 @@ CREATE TABLE IF NOT EXISTS event
PRIMARY KEY (id) PRIMARY KEY (id)
); );
CREATE TABLE IF NOT EXISTS user
(
id INT NOT NULL AUTO_INCREMENT,
email VARCHAR(150) NOT NULL,
password VARCHAR(255) NOT NULL,
admin BOOLEAN NOT NULL DEFAULT FALSE,
transfer BOOLEAN NOT NULL DEFAULT FALSE,
PRIMARY KEY (id),
UNIQUE (email)
);
CREATE TABLE IF NOT EXISTS phone CREATE TABLE IF NOT EXISTS phone
( (
id INT NOT NULL AUTO_INCREMENT, id INT NOT NULL AUTO_INCREMENT,
id_user INT NOT NULL, id_user INT NOT NULL,
number VARCHAR(25) NOT NULL, number VARCHAR(25) NOT NULL,
platform VARCHAR(100) NOT NULL, platform VARCHAR(100) NOT NULL,
platform_datas JSON NOT NULL, platform_datas TEXT NOT NULL,
CHECK (JSON_VALID(platform_datas)), CHECK (JSON_VALID(platform_datas)),
PRIMARY KEY (id), PRIMARY KEY (id),
FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE FOREIGN KEY (id_user) REFERENCES user (id) ON DELETE CASCADE ON UPDATE CASCADE
@ -163,10 +163,9 @@ CREATE TABLE IF NOT EXISTS validation
token VARCHAR(200) NOT NULL, token VARCHAR(200) NOT NULL,
random VARCHAR(32) NOT NULL, random VARCHAR(32) NOT NULL,
action VARCHAR(200) NOT NULL, action VARCHAR(200) NOT NULL,
datas JSON NOT NULL, datas TEXT NOT NULL,
CHECK (JSON_VALID(datas)), CHECK (JSON_VALID(datas)),
PRIMARY KEY (id), PRIMARY KEY (id)
UNIQUE(token)
); );
CREATE TABLE IF NOT EXISTS transfer CREATE TABLE IF NOT EXISTS transfer