Instead of migrate behavior being alter, added default db structure
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
FROM node:latest
|
||||
FROM hypriot/rpi-node:latest
|
||||
|
||||
RUN apt-get -y update && apt-get install -y apt-utils dialog vim
|
||||
COPY mysql-install.sh /tmp/mysql-install.sh
|
||||
COPY taglogger_db_structure.sql /tmp/taglogger_db_structure.sql
|
||||
RUN chmod +x /tmp/mysql-install.sh && /tmp/mysql-install.sh
|
||||
|
||||
RUN apt-get install -y python git-core wget
|
||||
|
||||
@@ -10,5 +10,7 @@ echo "mysqld_safe &" > /tmp/config && \
|
||||
rm -f /tmp/config
|
||||
echo "CREATE USER 'website'@'localhost' IDENTIFIED BY 'henrypump';GRANT ALL ON *.* TO 'website'@'localhost';CREATE USER 'admin'@'localhost' IDENTIFIED BY 'henrypump';GRANT ALL ON *.* to 'admin'@'localhost';CREATE USER 'admin'@'%' IDENTIFIED BY 'henrypump';GRANT ALL ON *.* to 'admin'@'%';FLUSH PRIVILEGES;CREATE DATABASE poconsole" | mysql
|
||||
|
||||
mysql --user="admin" --password="henrypump" --execute="source /tmp/taglogger_db_structure.sql"
|
||||
|
||||
|
||||
|
||||
|
||||
259
taglogger_db_structure.sql
Normal file
259
taglogger_db_structure.sql
Normal file
@@ -0,0 +1,259 @@
|
||||
-- MySQL dump 10.15 Distrib 10.0.27-MariaDB, for debian-linux-gnu (x86_64)
|
||||
--
|
||||
-- Host: localhost Database: poconsole
|
||||
-- ------------------------------------------------------
|
||||
-- Server version 10.0.27-MariaDB-0+deb8u1
|
||||
|
||||
/*!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 */;
|
||||
|
||||
--
|
||||
-- Current Database: `poconsole`
|
||||
--
|
||||
|
||||
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `poconsole` /*!40100 DEFAULT CHARACTER SET latin1 */;
|
||||
|
||||
USE `poconsole`;
|
||||
|
||||
--
|
||||
-- Table structure for table `config`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `config`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `config` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`parameter` varchar(255) DEFAULT NULL,
|
||||
`val` varchar(255) DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `parameter` (`parameter`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `config`
|
||||
--
|
||||
|
||||
LOCK TABLES `config` WRITE;
|
||||
/*!40000 ALTER TABLE `config` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `config` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `data_types`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `data_types`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `data_types` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`data_type` varchar(255) DEFAULT NULL,
|
||||
`plc_type` varchar(255) DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `data_type` (`data_type`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `data_types`
|
||||
--
|
||||
|
||||
LOCK TABLES `data_types` WRITE;
|
||||
/*!40000 ALTER TABLE `data_types` DISABLE KEYS */;
|
||||
INSERT INTO `data_types` VALUES (1,'Floating Point','REAL','2016-10-13 15:05:32','2016-10-13 15:05:32'),(2,'Integer','INT','2016-10-13 15:05:32','2016-10-13 15:05:32'),(3,'Boolean','BOOL','2016-10-13 15:05:32','2016-10-13 15:05:32');
|
||||
/*!40000 ALTER TABLE `data_types` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `device_types`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `device_types`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `device_types` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`dType` varchar(255) DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `dType` (`dType`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `device_types`
|
||||
--
|
||||
|
||||
LOCK TABLES `device_types` WRITE;
|
||||
/*!40000 ALTER TABLE `device_types` DISABLE KEYS */;
|
||||
INSERT INTO `device_types` VALUES (1,'CLX','2016-10-13 15:05:32','2016-10-13 15:05:32'),(2,'Micro800','2016-10-13 15:05:32','2016-10-13 15:05:32'),(3,'E300','2016-10-13 15:05:32','2016-10-13 15:05:32');
|
||||
/*!40000 ALTER TABLE `device_types` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `devices`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `devices`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `devices` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`device_type` int(11) DEFAULT NULL,
|
||||
`address` varchar(255) DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `devices`
|
||||
--
|
||||
|
||||
LOCK TABLES `devices` WRITE;
|
||||
/*!40000 ALTER TABLE `devices` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `devices` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `files`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `files`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `files` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`location` varchar(255) DEFAULT NULL,
|
||||
`description` varchar(255) DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `files`
|
||||
--
|
||||
|
||||
LOCK TABLES `files` WRITE;
|
||||
/*!40000 ALTER TABLE `files` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `files` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `tag_classes`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tag_classes`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `tag_classes` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`class_type` varchar(255) DEFAULT NULL,
|
||||
`description` varchar(255) DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
UNIQUE KEY `class_type` (`class_type`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tag_classes`
|
||||
--
|
||||
|
||||
LOCK TABLES `tag_classes` WRITE;
|
||||
/*!40000 ALTER TABLE `tag_classes` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `tag_classes` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `tag_vals`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tag_vals`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `tag_vals` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`tagID` int(11) DEFAULT NULL,
|
||||
`val` float DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tag_vals`
|
||||
--
|
||||
|
||||
LOCK TABLES `tag_vals` WRITE;
|
||||
/*!40000 ALTER TABLE `tag_vals` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `tag_vals` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
|
||||
--
|
||||
-- Table structure for table `tags`
|
||||
--
|
||||
|
||||
DROP TABLE IF EXISTS `tags`;
|
||||
/*!40101 SET @saved_cs_client = @@character_set_client */;
|
||||
/*!40101 SET character_set_client = utf8 */;
|
||||
CREATE TABLE `tags` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`name` varchar(255) DEFAULT NULL,
|
||||
`tag_class` int(11) DEFAULT NULL,
|
||||
`tag` varchar(255) DEFAULT NULL,
|
||||
`deviceID` int(11) DEFAULT NULL,
|
||||
`description` varchar(255) DEFAULT NULL,
|
||||
`data_type` int(11) DEFAULT NULL,
|
||||
`change_threshold` float DEFAULT NULL,
|
||||
`guarantee_sec` int(11) DEFAULT NULL,
|
||||
`map_function` varchar(255) DEFAULT NULL,
|
||||
`units` varchar(255) DEFAULT NULL,
|
||||
`minExpected` float DEFAULT NULL,
|
||||
`maxExpected` float DEFAULT NULL,
|
||||
`createdAt` datetime DEFAULT NULL,
|
||||
`updatedAt` datetime DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
|
||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||
|
||||
--
|
||||
-- Dumping data for table `tags`
|
||||
--
|
||||
|
||||
LOCK TABLES `tags` WRITE;
|
||||
/*!40000 ALTER TABLE `tags` DISABLE KEYS */;
|
||||
/*!40000 ALTER TABLE `tags` ENABLE KEYS */;
|
||||
UNLOCK TABLES;
|
||||
/*!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 */;
|
||||
|
||||
-- Dump completed on 2016-10-13 15:08:06
|
||||
@@ -27,7 +27,7 @@ module.exports.models = {
|
||||
* See http://sailsjs.org/#!/documentation/concepts/ORM/model-settings.html *
|
||||
* *
|
||||
***************************************************************************/
|
||||
migrate: 'alter',
|
||||
migrate: 'safe',
|
||||
|
||||
/**
|
||||
* This method adds records to the database
|
||||
|
||||
Reference in New Issue
Block a user