diff --git a/FAQ.md b/FAQ.md
new file mode 100644
index 000000000..99194f9e8
--- /dev/null
+++ b/FAQ.md
@@ -0,0 +1,8 @@
+### How can I upgrade from 1.x.x to 2.x.x? ###
+
+The major release 2.0.0 is backwards incompatible with existing installations,
+since the migration scripts are manually altered (See commit message: TODO) and the checksums in the metadata
+table of Flyway (our DB migration tool) need to be corrected.
+This can be done executing the following command:
+
+ mvn initialize flyway:repair
diff --git a/pom.xml b/pom.xml
index ed5397e0b..134fbb93a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -3,7 +3,7 @@
4.0.0
de.rwth.idsg
steve
- 1.3.0
+ 2.0.0-SNAPSHOT
jar
@@ -253,9 +253,12 @@
com.mysql.jdbc.Driver
- ${db.url}
+ jdbc:mysql://${db.ip}:${db.port}/
${db.user}
${db.password}
+
+ ${db.schema}
+
filesystem:src/main/resources/db/migration
@@ -302,7 +305,7 @@
com.mysql.jdbc.Driver
- ${db.url}
+ jdbc:mysql://${db.ip}:${db.port}/
${db.user}
${db.password}
@@ -312,7 +315,7 @@
org.jooq.util.mysql.MySQLDatabase
.*
- stevedb
+ ${db.schema}
false
diff --git a/src/main/java/de/rwth/idsg/steve/Application.java b/src/main/java/de/rwth/idsg/steve/Application.java
index 0a1d50951..a5ea3a0ef 100644
--- a/src/main/java/de/rwth/idsg/steve/Application.java
+++ b/src/main/java/de/rwth/idsg/steve/Application.java
@@ -42,7 +42,13 @@ private static void loadProperties() throws IOException {
STEVE_VERSION = prop.getString("steve.version");
- DB.URL = prop.getString("db.url");
+ DB.URL = new StringBuilder("jdbc:mysql://").append(prop.getString("db.ip"))
+ .append(":")
+ .append(prop.getInt("db.port"))
+ .append("/")
+ .append(prop.getString("db.schema"))
+ .toString();
+
DB.USERNAME = prop.getString("db.user");
DB.PASSWORD = prop.getString("db.password");
DB.SQL_LOGGING = prop.getBoolean("db.sql.logging");
diff --git a/src/main/resources/config/dev/main.properties b/src/main/resources/config/dev/main.properties
index f8da422d8..b9eca94b2 100644
--- a/src/main/resources/config/dev/main.properties
+++ b/src/main/resources/config/dev/main.properties
@@ -1,6 +1,8 @@
# Database configuration
#
-db.url = jdbc:mysql://localhost:3306/stevedb
+db.ip = localhost
+db.port = 3306
+db.schema = stevedb
db.user = root
db.password = come47on
diff --git a/src/main/resources/config/prod/main.properties b/src/main/resources/config/prod/main.properties
index f976428c4..6c2a59196 100644
--- a/src/main/resources/config/prod/main.properties
+++ b/src/main/resources/config/prod/main.properties
@@ -1,6 +1,8 @@
# Database configuration
#
-db.url = jdbc:mysql://localhost:3306/stevedb
+db.ip = localhost
+db.port = 3306
+db.schema = stevedb
db.user = root
db.password = come47on
diff --git a/src/main/resources/db/migration/V0_6_6__inital.sql b/src/main/resources/db/migration/V0_6_6__inital.sql
index 5ac690999..96661a117 100644
--- a/src/main/resources/db/migration/V0_6_6__inital.sql
+++ b/src/main/resources/db/migration/V0_6_6__inital.sql
@@ -1,29 +1,7 @@
-CREATE DATABASE IF NOT EXISTS `stevedb` /*!40100 DEFAULT CHARACTER SET latin1 */;
-USE `stevedb`;
--- MySQL dump 10.13 Distrib 5.6.13, for osx10.7 (x86_64)
---
--- Host: localhost Database: stevedb
--- ------------------------------------------------------
--- Server version 5.5.32-0ubuntu0.13.04.1
-
-/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
-/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
-/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
-/*!40101 SET NAMES utf8 */;
-/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
-/*!40103 SET TIME_ZONE='+00:00' */;
-/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
-/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
-/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
-
--
-- Table structure for table `chargebox`
--
-DROP TABLE IF EXISTS `chargebox`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `chargebox` (
`chargeBoxId` varchar(30) NOT NULL,
`endpoint_address` varchar(45) DEFAULT NULL,
@@ -44,15 +22,25 @@ CREATE TABLE `chargebox` (
PRIMARY KEY (`chargeBoxId`),
UNIQUE KEY `chargeBoxId_UNIQUE` (`chargeBoxId`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
+
+--
+-- Table structure for table `user`
+--
+
+CREATE TABLE `user` (
+ `idTag` varchar(15) NOT NULL,
+ `parentIdTag` varchar(15) DEFAULT NULL,
+ `expiryDate` timestamp NULL DEFAULT NULL,
+ `inTransaction` tinyint(1) unsigned NOT NULL,
+ `blocked` tinyint(1) unsigned NOT NULL,
+ PRIMARY KEY (`idTag`),
+ UNIQUE KEY `idTag_UNIQUE` (`idTag`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Table structure for table `connector`
--
-DROP TABLE IF EXISTS `connector`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `connector` (
`connector_pk` int(11) unsigned NOT NULL AUTO_INCREMENT,
`chargeBoxId` varchar(30) NOT NULL,
@@ -62,39 +50,12 @@ CREATE TABLE `connector` (
UNIQUE KEY `connector_cbid_cid_UNIQUE` (`chargeBoxId`,`connectorId`),
CONSTRAINT `FK_chargeBoxId_c` FOREIGN KEY (`chargeBoxId`) REFERENCES `chargebox` (`chargeBoxId`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `connector_metervalue`
---
-DROP TABLE IF EXISTS `connector_metervalue`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `connector_metervalue` (
- `connector_pk` int(11) unsigned NOT NULL,
- `transaction_pk` int(10) unsigned DEFAULT NULL,
- `valueTimestamp` timestamp NULL DEFAULT NULL,
- `value` varchar(45) DEFAULT NULL,
- `readingContext` varchar(20) DEFAULT NULL,
- `format` varchar(20) DEFAULT NULL,
- `measurand` varchar(40) DEFAULT NULL,
- `location` varchar(10) DEFAULT NULL,
- `unit` varchar(10) DEFAULT NULL,
- KEY `FK_cm_pk_idx` (`connector_pk`),
- KEY `FK_tid_cm_idx` (`transaction_pk`),
- CONSTRAINT `FK_pk_cm` FOREIGN KEY (`connector_pk`) REFERENCES `connector` (`connector_pk`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `FK_tid_cm` FOREIGN KEY (`transaction_pk`) REFERENCES `transaction` (`transaction_pk`) ON DELETE SET NULL ON UPDATE NO ACTION
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `connector_status`
--
-DROP TABLE IF EXISTS `connector_status`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `connector_status` (
`connector_pk` int(11) unsigned NOT NULL,
`statusTimestamp` timestamp NULL DEFAULT NULL,
@@ -106,20 +67,15 @@ CREATE TABLE `connector_status` (
KEY `FK_cs_pk_idx` (`connector_pk`),
CONSTRAINT `FK_cs_pk` FOREIGN KEY (`connector_pk`) REFERENCES `connector` (`connector_pk`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `dbVersion`
--
-DROP TABLE IF EXISTS `dbVersion`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `dbVersion` (
`version` varchar(10) NOT NULL,
`upateTimestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `dbVersion`
@@ -131,13 +87,64 @@ INSERT INTO `dbVersion` (`version`) VALUES ('0.6.6');
/*!40000 ALTER TABLE `dbVersion` ENABLE KEYS */;
UNLOCK TABLES;
+--
+-- Table structure for table `transaction`
+--
+
+CREATE TABLE `transaction` (
+ `transaction_pk` int(10) unsigned NOT NULL AUTO_INCREMENT,
+ `connector_pk` int(11) unsigned NOT NULL,
+ `idTag` varchar(15) NOT NULL,
+ `startTimestamp` timestamp NULL DEFAULT NULL,
+ `startValue` varchar(45) DEFAULT NULL,
+ `stopTimestamp` timestamp NULL DEFAULT NULL,
+ `stopValue` varchar(45) DEFAULT NULL,
+ PRIMARY KEY (`transaction_pk`),
+ UNIQUE KEY `transaction_pk_UNIQUE` (`transaction_pk`),
+ KEY `idTag_idx` (`idTag`),
+ KEY `connector_pk_idx` (`connector_pk`),
+ CONSTRAINT `FK_connector_pk_t` FOREIGN KEY (`connector_pk`) REFERENCES `connector` (`connector_pk`) ON DELETE CASCADE ON UPDATE NO ACTION,
+ CONSTRAINT `FK_idTag_t` FOREIGN KEY (`idTag`) REFERENCES `user` (`idTag`) ON DELETE CASCADE ON UPDATE NO ACTION
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
+--
+-- Triggers on table `transaction`
+--
+
+DELIMITER ;;
+CREATE TRIGGER `transaction_AINS` AFTER INSERT ON transaction FOR EACH ROW
+ UPDATE user SET user.inTransaction=1 WHERE user.idTag=NEW.idTag;;
+DELIMITER ;
+
+DELIMITER ;;
+CREATE TRIGGER `transaction_AUPD` AFTER UPDATE ON transaction FOR EACH ROW
+ UPDATE user SET user.inTransaction=0 WHERE user.idTag=NEW.idTag;;
+DELIMITER ;
+
+--
+-- Table structure for table `connector_metervalue`
+--
+
+CREATE TABLE `connector_metervalue` (
+ `connector_pk` int(11) unsigned NOT NULL,
+ `transaction_pk` int(10) unsigned DEFAULT NULL,
+ `valueTimestamp` timestamp NULL DEFAULT NULL,
+ `value` varchar(45) DEFAULT NULL,
+ `readingContext` varchar(20) DEFAULT NULL,
+ `format` varchar(20) DEFAULT NULL,
+ `measurand` varchar(40) DEFAULT NULL,
+ `location` varchar(10) DEFAULT NULL,
+ `unit` varchar(10) DEFAULT NULL,
+ KEY `FK_cm_pk_idx` (`connector_pk`),
+ KEY `FK_tid_cm_idx` (`transaction_pk`),
+ CONSTRAINT `FK_pk_cm` FOREIGN KEY (`connector_pk`) REFERENCES `connector` (`connector_pk`) ON DELETE CASCADE ON UPDATE NO ACTION,
+ CONSTRAINT `FK_tid_cm` FOREIGN KEY (`transaction_pk`) REFERENCES `transaction` (`transaction_pk`) ON DELETE SET NULL ON UPDATE NO ACTION
+) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+
--
-- Table structure for table `reservation`
--
-DROP TABLE IF EXISTS `reservation`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `reservation` (
`reservation_pk` int(10) unsigned NOT NULL AUTO_INCREMENT,
`idTag` varchar(15) NOT NULL,
@@ -151,15 +158,11 @@ CREATE TABLE `reservation` (
CONSTRAINT `FK_chargeBoxId_r` FOREIGN KEY (`chargeBoxId`) REFERENCES `chargebox` (`chargeBoxId`) ON DELETE CASCADE ON UPDATE NO ACTION,
CONSTRAINT `FK_idTag_r` FOREIGN KEY (`idTag`) REFERENCES `user` (`idTag`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `reservation_expired`
--
-DROP TABLE IF EXISTS `reservation_expired`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `reservation_expired` (
`reservation_pk` int(10) unsigned NOT NULL,
`idTag` varchar(15) NOT NULL,
@@ -167,119 +170,19 @@ CREATE TABLE `reservation_expired` (
`startDatetime` datetime NOT NULL,
`expiryDatetime` datetime NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Table structure for table `transaction`
---
-
-DROP TABLE IF EXISTS `transaction`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `transaction` (
- `transaction_pk` int(10) unsigned NOT NULL AUTO_INCREMENT,
- `connector_pk` int(11) unsigned NOT NULL,
- `idTag` varchar(15) NOT NULL,
- `startTimestamp` timestamp NULL DEFAULT NULL,
- `startValue` varchar(45) DEFAULT NULL,
- `stopTimestamp` timestamp NULL DEFAULT NULL,
- `stopValue` varchar(45) DEFAULT NULL,
- PRIMARY KEY (`transaction_pk`),
- UNIQUE KEY `transaction_pk_UNIQUE` (`transaction_pk`),
- KEY `idTag_idx` (`idTag`),
- KEY `connector_pk_idx` (`connector_pk`),
- CONSTRAINT `FK_connector_pk_t` FOREIGN KEY (`connector_pk`) REFERENCES `connector` (`connector_pk`) ON DELETE CASCADE ON UPDATE NO ACTION,
- CONSTRAINT `FK_idTag_t` FOREIGN KEY (`idTag`) REFERENCES `user` (`idTag`) ON DELETE CASCADE ON UPDATE NO ACTION
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = 'STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' */ ;
-DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `transaction_AINS` AFTER INSERT ON transaction FOR EACH ROW
-UPDATE user SET user.inTransaction=1 WHERE user.idTag=NEW.idTag */;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;
-/*!50003 SET character_set_client = utf8 */ ;
-/*!50003 SET character_set_results = utf8 */ ;
-/*!50003 SET collation_connection = utf8_general_ci */ ;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;
-/*!50003 SET sql_mode = '' */ ;
-DELIMITER ;;
-/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`localhost`*/ /*!50003 TRIGGER `transaction_AUPD` AFTER UPDATE ON transaction FOR EACH ROW
--- Edit trigger body code below this line. Do not edit lines above this one
-UPDATE user SET user.inTransaction=0 WHERE user.idTag=NEW.idTag */;;
-DELIMITER ;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;
-/*!50003 SET character_set_client = @saved_cs_client */ ;
-/*!50003 SET character_set_results = @saved_cs_results */ ;
-/*!50003 SET collation_connection = @saved_col_connection */ ;
--
--- Table structure for table `user`
+-- Dumping events for database
--
-DROP TABLE IF EXISTS `user`;
-/*!40101 SET @saved_cs_client = @@character_set_client */;
-/*!40101 SET character_set_client = utf8 */;
-CREATE TABLE `user` (
- `idTag` varchar(15) NOT NULL,
- `parentIdTag` varchar(15) DEFAULT NULL,
- `expiryDate` timestamp NULL DEFAULT NULL,
- `inTransaction` tinyint(1) unsigned NOT NULL,
- `blocked` tinyint(1) unsigned NOT NULL,
- PRIMARY KEY (`idTag`),
- UNIQUE KEY `idTag_UNIQUE` (`idTag`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1;
-/*!40101 SET character_set_client = @saved_cs_client */;
-
---
--- Dumping events for database 'stevedb'
---
-/*!50106 SET @save_time_zone= @@TIME_ZONE */ ;
-/*!50106 DROP EVENT IF EXISTS `expire_reservations` */;
DELIMITER ;;
-/*!50003 SET @saved_cs_client = @@character_set_client */ ;;
-/*!50003 SET @saved_cs_results = @@character_set_results */ ;;
-/*!50003 SET @saved_col_connection = @@collation_connection */ ;;
-/*!50003 SET character_set_client = utf8 */ ;;
-/*!50003 SET character_set_results = utf8 */ ;;
-/*!50003 SET collation_connection = utf8_general_ci */ ;;
-/*!50003 SET @saved_sql_mode = @@sql_mode */ ;;
-/*!50003 SET sql_mode = '' */ ;;
-/*!50003 SET @saved_time_zone = @@time_zone */ ;;
-/*!50003 SET time_zone = 'SYSTEM' */ ;;
-/*!50106 CREATE*/ /*!50117 DEFINER=`root`@`localhost`*/ /*!50106 EVENT `expire_reservations` ON SCHEDULE EVERY 1 DAY STARTS '2013-11-16 03:00:00' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
-INSERT INTO reservation_expired (SELECT * FROM reservation WHERE reservation.expiryDatetime <= NOW());
-DELETE FROM reservation WHERE reservation.expiryDatetime <= NOW();
-END */ ;;
-/*!50003 SET time_zone = @saved_time_zone */ ;;
-/*!50003 SET sql_mode = @saved_sql_mode */ ;;
-/*!50003 SET character_set_client = @saved_cs_client */ ;;
-/*!50003 SET character_set_results = @saved_cs_results */ ;;
-/*!50003 SET collation_connection = @saved_col_connection */ ;;
-DELIMITER ;
-/*!50106 SET TIME_ZONE= @save_time_zone */ ;
-/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
-/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
-/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
-/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
-/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
-/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
-/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
-/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
+CREATE EVENT `expire_reservations`
+ ON SCHEDULE EVERY 1 DAY STARTS '2013-11-16 03:00:00' ON COMPLETION NOT PRESERVE ENABLE DO
+ BEGIN
+ INSERT INTO reservation_expired (SELECT * FROM reservation WHERE reservation.expiryDatetime <= NOW());
+ DELETE FROM reservation WHERE reservation.expiryDatetime <= NOW();
+ END;;
--- Dump completed on 2013-11-29 15:37:19
+DELIMITER ;
diff --git a/src/main/resources/db/migration/V0_6_7__update.sql b/src/main/resources/db/migration/V0_6_7__update.sql
index af380fa54..dacf1164f 100644
--- a/src/main/resources/db/migration/V0_6_7__update.sql
+++ b/src/main/resources/db/migration/V0_6_7__update.sql
@@ -1,8 +1,8 @@
-ALTER TABLE `stevedb`.`dbVersion` CHANGE COLUMN `upateTimestamp` `updateTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ;
+ALTER TABLE `dbVersion` CHANGE COLUMN `upateTimestamp` `updateTimestamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP ;
-UPDATE `stevedb`.`dbVersion` SET `version` = '0.6.7';
+UPDATE `dbVersion` SET `version` = '0.6.7';
-ALTER TABLE `stevedb`.`chargebox` ADD COLUMN `lastHeartbeatTimestamp` TIMESTAMP NULL DEFAULT NULL AFTER `diagnosticsTimestamp` ;
+ALTER TABLE `chargebox` ADD COLUMN `lastHeartbeatTimestamp` TIMESTAMP NULL DEFAULT NULL AFTER `diagnosticsTimestamp` ;
DROP EVENT IF EXISTS expire_reservations;
DELIMITER ;;
@@ -14,7 +14,7 @@ DELETE FROM reservation WHERE reservation.expiryDatetime <= NOW();
END ;;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `getStats`(
+CREATE PROCEDURE `getStats`(
OUT numChargeBoxes INT,
OUT numUsers INT,
OUT numReservs INT,
@@ -74,4 +74,4 @@ BEGIN
AS t1 ON cs.connector_pk = t1.connector_pk AND cs.statusTimestamp = t1.Max
WHERE cs.status = 'UNAVAILABLE' GROUP BY cs.status;
-END ;;
\ No newline at end of file
+END ;;
diff --git a/src/main/resources/db/migration/V0_6_8__update.sql b/src/main/resources/db/migration/V0_6_8__update.sql
index 4df9679c4..fbe84b91f 100644
--- a/src/main/resources/db/migration/V0_6_8__update.sql
+++ b/src/main/resources/db/migration/V0_6_8__update.sql
@@ -1,9 +1,9 @@
-UPDATE `stevedb`.`dbVersion` SET `version` = '0.6.8';
+UPDATE `dbVersion` SET `version` = '0.6.8';
-DROP PROCEDURE `stevedb`.`getStats`;
+DROP PROCEDURE `getStats`;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stevedb`.`getStats`(
+CREATE PROCEDURE `getStats`(
OUT numChargeBoxes INT,
OUT numUsers INT,
OUT numReservs INT,
@@ -63,4 +63,4 @@ BEGIN
AS t1 ON cs.connector_pk = t1.connector_pk AND cs.statusTimestamp = t1.Max
WHERE cs.status = 'UNAVAILABLE';
END ;;
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/src/main/resources/db/migration/V0_6_9__update.sql b/src/main/resources/db/migration/V0_6_9__update.sql
index f9a656ba2..0c2155abb 100644
--- a/src/main/resources/db/migration/V0_6_9__update.sql
+++ b/src/main/resources/db/migration/V0_6_9__update.sql
@@ -1,8 +1,8 @@
-UPDATE `stevedb`.`dbVersion` SET `version` = '0.6.9';
+UPDATE `dbVersion` SET `version` = '0.6.9';
-ALTER TABLE `stevedb`.`user`
+ALTER TABLE `user`
ADD CONSTRAINT `FK_user_parentIdTag`
FOREIGN KEY (`parentIdTag`)
- REFERENCES `stevedb`.`user` (`idTag`)
+ REFERENCES `user` (`idTag`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
diff --git a/src/main/resources/db/migration/V0_7_0__update.sql b/src/main/resources/db/migration/V0_7_0__update.sql
index e8a85cdb7..73ecc67bd 100644
--- a/src/main/resources/db/migration/V0_7_0__update.sql
+++ b/src/main/resources/db/migration/V0_7_0__update.sql
@@ -1,23 +1,23 @@
-UPDATE `stevedb`.`dbVersion` SET `version` = '0.7.0';
+UPDATE `dbVersion` SET `version` = '0.7.0';
-DROP EVENT IF EXISTS `stevedb`.`expire_reservations`;
+DROP EVENT IF EXISTS `expire_reservations`;
-DROP TABLE `stevedb`.`reservation_expired`;
+DROP TABLE `reservation_expired`;
-ALTER TABLE `stevedb`.`reservation`
+ALTER TABLE `reservation`
ADD COLUMN `status` VARCHAR(15) NOT NULL AFTER `expiryDatetime`,
ADD COLUMN `transaction_pk` INT(10) UNSIGNED DEFAULT NULL AFTER `reservation_pk`,
ADD UNIQUE INDEX `transaction_pk_UNIQUE` (`transaction_pk` ASC),
ADD CONSTRAINT `FK_transaction_pk_r`
FOREIGN KEY (`transaction_pk`)
- REFERENCES `stevedb`.`transaction` (`transaction_pk`)
+ REFERENCES `transaction` (`transaction_pk`)
ON DELETE NO ACTION
ON UPDATE NO ACTION;
-DROP PROCEDURE `stevedb`.`getStats`;
+DROP PROCEDURE `getStats`;
DELIMITER ;;
-CREATE DEFINER=`root`@`localhost` PROCEDURE `stevedb`.`getStats`(
+CREATE PROCEDURE `getStats`(
OUT numChargeBoxes INT,
OUT numUsers INT,
OUT numReservs INT,
@@ -77,4 +77,4 @@ BEGIN
AS t1 ON cs.connector_pk = t1.connector_pk AND cs.statusTimestamp = t1.Max
WHERE cs.status = 'UNAVAILABLE';
END ;;
-DELIMITER ;
\ No newline at end of file
+DELIMITER ;
diff --git a/src/main/resources/db/migration/V0_7_1__update.sql b/src/main/resources/db/migration/V0_7_1__update.sql
index 23fee01d5..022141d12 100644
--- a/src/main/resources/db/migration/V0_7_1__update.sql
+++ b/src/main/resources/db/migration/V0_7_1__update.sql
@@ -1 +1 @@
-DROP TABLE `stevedb`.`dbVersion`;
\ No newline at end of file
+DROP TABLE `dbVersion`;
diff --git a/src/main/resources/db/migration/V0_7_2__update.sql b/src/main/resources/db/migration/V0_7_2__update.sql
index 957148276..e4ef755b7 100644
--- a/src/main/resources/db/migration/V0_7_2__update.sql
+++ b/src/main/resources/db/migration/V0_7_2__update.sql
@@ -1,8 +1,8 @@
-ALTER TABLE `stevedb`.`chargebox`
+ALTER TABLE `chargebox`
CHANGE COLUMN `ocppVersion` `ocppProtocol` VARCHAR(10) NULL DEFAULT NULL ;
--
-- Migrate existing charge points from old 'version' scheme to the newer 'protocol' scheme
--
-UPDATE `stevedb`.`chargebox` SET `ocppProtocol`='ocpp1.2S' WHERE `ocppProtocol`='1.2';
-UPDATE `stevedb`.`chargebox` SET `ocppProtocol`='ocpp1.5S' WHERE `ocppProtocol`='1.5';
\ No newline at end of file
+UPDATE `chargebox` SET `ocppProtocol`='ocpp1.2S' WHERE `ocppProtocol`='1.2';
+UPDATE `chargebox` SET `ocppProtocol`='ocpp1.5S' WHERE `ocppProtocol`='1.5';
diff --git a/src/main/resources/db/migration/V0_7_3__update.sql b/src/main/resources/db/migration/V0_7_3__update.sql
index 3d316925a..4682524c3 100644
--- a/src/main/resources/db/migration/V0_7_3__update.sql
+++ b/src/main/resources/db/migration/V0_7_3__update.sql
@@ -1,2 +1,2 @@
-ALTER TABLE `stevedb`.`chargebox`
+ALTER TABLE `chargebox`
CHANGE COLUMN `fwVersion` `fwVersion` VARCHAR(50) NULL DEFAULT NULL ;
diff --git a/src/main/resources/db/migration/V0_7_6__update.sql b/src/main/resources/db/migration/V0_7_6__update.sql
index 38f43a513..6b872fdd5 100644
--- a/src/main/resources/db/migration/V0_7_6__update.sql
+++ b/src/main/resources/db/migration/V0_7_6__update.sql
@@ -1,5 +1,5 @@
-ALTER TABLE `stevedb`.`user`
+ALTER TABLE `user`
ADD COLUMN `note` TEXT NULL COMMENT '' AFTER `blocked`;
-ALTER TABLE `stevedb`.`chargebox`
-ADD COLUMN `note` TEXT NULL COMMENT '' AFTER `lastHeartbeatTimestamp`;
\ No newline at end of file
+ALTER TABLE `chargebox`
+ADD COLUMN `note` TEXT NULL COMMENT '' AFTER `lastHeartbeatTimestamp`;