From 41f094201aaeb573968d2b96b9dc6760e0c5aedc Mon Sep 17 00:00:00 2001
From: Tharre <tharre3@gmail.com>
Date: Sat, 12 May 2018 01:58:06 +0200
Subject: Fix DBUnit's enums and revert database changes

---
 src/main/resources/sql/database.sql | 20 +++++++-------------
 1 file changed, 7 insertions(+), 13 deletions(-)

(limited to 'src/main/resources/sql/database.sql')

diff --git a/src/main/resources/sql/database.sql b/src/main/resources/sql/database.sql
index 4f3adf7..ddedeac 100644
--- a/src/main/resources/sql/database.sql
+++ b/src/main/resources/sql/database.sql
@@ -1,30 +1,26 @@
 CREATE TABLE IF NOT EXISTS VehicleVersion (
   id BIGINT AUTO_INCREMENT PRIMARY KEY,
   name VARCHAR(100) NOT NULL,
-  constructionType VARCHAR NOT NULL,
-  type VARCHAR NOT NULL,
+  constructionType ENUM('NORMAL', 'HOCHDACH', 'MITTELHOCHDACH') NOT NULL,
+  type ENUM('BKTW', 'KTW_B', 'KTW', 'RTW', 'NEF', 'NAH') NOT NULL,
   hasNef BOOLEAN NOT NULL,
-  CHECK constructionType IN ('NORMAL', 'HOCHDACH', 'MITTELHOCHDACH'),
-  CHECK type IN ('BKTW', 'KTW-B', 'KTW', 'RTW', 'NEF', 'NAH')
 );
 
 CREATE TABLE IF NOT EXISTS Vehicle (
   id BIGINT AUTO_INCREMENT PRIMARY KEY,
   version BIGINT NOT NULL,
-  status VARCHAR NOT NULL,
+  status ENUM('ABGEMELDET', 'FREI_WACHE', 'ZUM_BERUFUNGSORT', 'AM_BERUFUNGSORT', 'ZUM_ZIELORT',
+              'AM_ZIELORT', 'FREI_FUNK', 'DELETED') NOT NULL,
   FOREIGN KEY (version) REFERENCES VehicleVersion(id),
-  CHECK status IN ('ABGEMELDET', 'FREI_WACHE', 'ZUM_BERUFUNGSORT', 'AM_BERUFUNGSORT', 'ZUM_ZIELORT',
-              'AM_ZIELORT', 'FREI_FUNK', 'DELETED')
 );
 
 CREATE TABLE IF NOT EXISTS EmployeeVersion (
   id BIGINT AUTO_INCREMENT PRIMARY KEY,
   name VARCHAR(100) NOT NULL,
   birthday DATE NOT NULL,
-  educationLevel VARCHAR NOT NULL,
+  educationLevel ENUM('RS', 'NFS', 'NKV', 'NKA', 'NKI', 'NA') NOT NULL,
   isDriver BOOLEAN NOT NULL,
   isPilot BOOLEAN NOT NULL,
-  CHECK educationLevel IN ('RS', 'NFS', 'NKV', 'NKA', 'NKI', 'NA')
 );
 
 CREATE TABLE IF NOT EXISTS Employee (
@@ -47,13 +43,11 @@ CREATE TABLE IF NOT EXISTS Registration (
 CREATE TABLE IF NOT EXISTS Operation (
   id BIGINT AUTO_INCREMENT PRIMARY KEY,
   opCode VARCHAR(20) NOT NULL,
-  severity VARCHAR NOT NULL,
+  severity ENUM('A', 'B', 'C', 'D', 'E', 'O') NOT NULL,
   created TIMESTAMP NOT NULL,
   destination VARCHAR(100) NOT NULL,
   additionalInfo VARCHAR(100),
-  status VARCHAR NOT NULL,
-  CHECK severity IN ('A', 'B', 'C', 'D', 'E', 'O'),
-  CHECK status IN ('ACTIVE', 'COMPLETED', 'CANCELLED')
+  status ENUM('ACTIVE', 'COMPLETED', 'CANCELLED'),
 );
 
 CREATE TABLE IF NOT EXISTS VehicleOperation (
-- 
cgit v1.2.3-70-g09d2

