changeset 120:9abb62238eb4

Add test for database schema upgrade.
author Daniele Nicolodi <daniele@grinta.net>
date Tue, 11 Oct 2011 17:47:52 +0200
parents 9a2f9b2ad5c9
children 41137a8a2b4c
files src/ltpdarepo/sql/dump-v2.4.sql src/ltpdarepo/tests/test_schema.py
diffstat 2 files changed, 930 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ltpdarepo/sql/dump-v2.4.sql	Tue Oct 11 17:47:52 2011 +0200
@@ -0,0 +1,757 @@
+
+/*!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 */;
+
+/*!40000 DROP DATABASE IF EXISTS `mysql`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `mysql` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `mysql`;
+DROP TABLE IF EXISTS `columns_priv`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `columns_priv` (
+  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Column_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
+  PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`,`Column_name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Column privileges';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `columns_priv` WRITE;
+/*!40000 ALTER TABLE `columns_priv` DISABLE KEYS */;
+/*!40000 ALTER TABLE `columns_priv` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `db`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `db` (
+  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  PRIMARY KEY (`Host`,`Db`,`User`),
+  KEY `User` (`User`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Database privileges';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `db` WRITE;
+/*!40000 ALTER TABLE `db` DISABLE KEYS */;
+INSERT INTO `db` VALUES ('127.0.0.1','test','u1','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('127.0.0.1','db1','u1','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('localhost','test','u1','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('localhost','db1','u1','Y','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('%','test','u2','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('%','db1','u2','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('127.0.0.1','test','u2','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('127.0.0.1','db1','u2','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('localhost','test','u2','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N'),('localhost','db1','u2','Y','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N');
+/*!40000 ALTER TABLE `db` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `event`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `event` (
+  `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `name` char(64) NOT NULL DEFAULT '',
+  `body` longblob NOT NULL,
+  `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `execute_at` datetime DEFAULT NULL,
+  `interval_value` int(11) DEFAULT NULL,
+  `interval_field` enum('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') DEFAULT NULL,
+  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `last_executed` datetime DEFAULT NULL,
+  `starts` datetime DEFAULT NULL,
+  `ends` datetime DEFAULT NULL,
+  `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED',
+  `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP',
+  `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
+  `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `originator` int(10) unsigned NOT NULL,
+  `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM',
+  `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `body_utf8` longblob,
+  PRIMARY KEY (`db`,`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Events';
+/*!40101 SET character_set_client = @saved_cs_client */;
+DROP TABLE IF EXISTS `func`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `func` (
+  `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `ret` tinyint(1) NOT NULL DEFAULT '0',
+  `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL,
+  PRIMARY KEY (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='User defined functions';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `func` WRITE;
+/*!40000 ALTER TABLE `func` DISABLE KEYS */;
+/*!40000 ALTER TABLE `func` ENABLE KEYS */;
+UNLOCK TABLES;
+
+DROP TABLE IF EXISTS `host`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `host` (
+  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  PRIMARY KEY (`Host`,`Db`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Host privileges;  Merged with database privileges';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `host` WRITE;
+/*!40000 ALTER TABLE `host` DISABLE KEYS */;
+/*!40000 ALTER TABLE `host` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `ndb_binlog_index`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `ndb_binlog_index` (
+  `Position` bigint(20) unsigned NOT NULL,
+  `File` varchar(255) NOT NULL,
+  `epoch` bigint(20) unsigned NOT NULL,
+  `inserts` bigint(20) unsigned NOT NULL,
+  `updates` bigint(20) unsigned NOT NULL,
+  `deletes` bigint(20) unsigned NOT NULL,
+  `schemaops` bigint(20) unsigned NOT NULL,
+  PRIMARY KEY (`epoch`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `ndb_binlog_index` WRITE;
+/*!40000 ALTER TABLE `ndb_binlog_index` DISABLE KEYS */;
+/*!40000 ALTER TABLE `ndb_binlog_index` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `plugin`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `plugin` (
+  `name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `dl` char(128) COLLATE utf8_bin NOT NULL DEFAULT '',
+  PRIMARY KEY (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='MySQL plugins';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `plugin` WRITE;
+/*!40000 ALTER TABLE `plugin` DISABLE KEYS */;
+/*!40000 ALTER TABLE `plugin` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `proc`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `proc` (
+  `db` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `name` char(64) NOT NULL DEFAULT '',
+  `type` enum('FUNCTION','PROCEDURE') NOT NULL,
+  `specific_name` char(64) NOT NULL DEFAULT '',
+  `language` enum('SQL') NOT NULL DEFAULT 'SQL',
+  `sql_data_access` enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NOT NULL DEFAULT 'CONTAINS_SQL',
+  `is_deterministic` enum('YES','NO') NOT NULL DEFAULT 'NO',
+  `security_type` enum('INVOKER','DEFINER') NOT NULL DEFAULT 'DEFINER',
+  `param_list` blob NOT NULL,
+  `returns` longblob NOT NULL,
+  `body` longblob NOT NULL,
+  `definer` char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
+  `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') NOT NULL DEFAULT '',
+  `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
+  `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `db_collation` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL,
+  `body_utf8` longblob,
+  PRIMARY KEY (`db`,`name`,`type`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Stored Procedures';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `proc` WRITE;
+/*!40000 ALTER TABLE `proc` DISABLE KEYS */;
+/*!40000 ALTER TABLE `proc` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `procs_priv`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `procs_priv` (
+  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Routine_name` char(64) CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `Routine_type` enum('FUNCTION','PROCEDURE') COLLATE utf8_bin NOT NULL,
+  `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Proc_priv` set('Execute','Alter Routine','Grant') CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  PRIMARY KEY (`Host`,`Db`,`User`,`Routine_name`,`Routine_type`),
+  KEY `Grantor` (`Grantor`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Procedure privileges';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `procs_priv` WRITE;
+/*!40000 ALTER TABLE `procs_priv` DISABLE KEYS */;
+/*!40000 ALTER TABLE `procs_priv` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `servers`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `servers` (
+  `Server_name` char(64) NOT NULL DEFAULT '',
+  `Host` char(64) NOT NULL DEFAULT '',
+  `Db` char(64) NOT NULL DEFAULT '',
+  `Username` char(64) NOT NULL DEFAULT '',
+  `Password` char(64) NOT NULL DEFAULT '',
+  `Port` int(4) NOT NULL DEFAULT '0',
+  `Socket` char(64) NOT NULL DEFAULT '',
+  `Wrapper` char(64) NOT NULL DEFAULT '',
+  `Owner` char(64) NOT NULL DEFAULT '',
+  PRIMARY KEY (`Server_name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='MySQL Foreign Servers table';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `servers` WRITE;
+/*!40000 ALTER TABLE `servers` DISABLE KEYS */;
+/*!40000 ALTER TABLE `servers` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `tables_priv`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tables_priv` (
+  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Db` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Table_name` char(64) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Grantor` char(77) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+  `Table_priv` set('Select','Insert','Update','Delete','Create','Drop','Grant','References','Index','Alter','Create View','Show view','Trigger') CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `Column_priv` set('Select','Insert','Update','References') CHARACTER SET utf8 NOT NULL DEFAULT '',
+  PRIMARY KEY (`Host`,`Db`,`User`,`Table_name`),
+  KEY `Grantor` (`Grantor`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Table privileges';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `tables_priv` WRITE;
+/*!40000 ALTER TABLE `tables_priv` DISABLE KEYS */;
+INSERT INTO `tables_priv` VALUES ('localhost','db1','u1','transactions','root@localhost','2011-09-11 20:47:21','Select,Insert',''),('127.0.0.1','db1','u1','transactions','root@localhost','2011-09-11 20:47:21','Select,Insert',''),('localhost','db1','u2','transactions','root@localhost','2011-09-12 08:49:35','Select,Insert',''),('127.0.0.1','db1','u2','transactions','root@localhost','2011-09-12 08:49:35','Select,Insert',''),('%','db1','u2','transactions','root@localhost','2011-09-12 08:49:35','Select,Insert','');
+/*!40000 ALTER TABLE `tables_priv` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `time_zone`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `time_zone` (
+  `Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
+  `Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N',
+  PRIMARY KEY (`Time_zone_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zones';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `time_zone` WRITE;
+/*!40000 ALTER TABLE `time_zone` DISABLE KEYS */;
+/*!40000 ALTER TABLE `time_zone` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `time_zone_leap_second`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `time_zone_leap_second` (
+  `Transition_time` bigint(20) NOT NULL,
+  `Correction` int(11) NOT NULL,
+  PRIMARY KEY (`Transition_time`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Leap seconds information for time zones';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `time_zone_leap_second` WRITE;
+/*!40000 ALTER TABLE `time_zone_leap_second` DISABLE KEYS */;
+/*!40000 ALTER TABLE `time_zone_leap_second` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `time_zone_name`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `time_zone_name` (
+  `Name` char(64) NOT NULL,
+  `Time_zone_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`Name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone names';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `time_zone_name` WRITE;
+/*!40000 ALTER TABLE `time_zone_name` DISABLE KEYS */;
+/*!40000 ALTER TABLE `time_zone_name` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `time_zone_transition`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `time_zone_transition` (
+  `Time_zone_id` int(10) unsigned NOT NULL,
+  `Transition_time` bigint(20) NOT NULL,
+  `Transition_type_id` int(10) unsigned NOT NULL,
+  PRIMARY KEY (`Time_zone_id`,`Transition_time`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transitions';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `time_zone_transition` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition` DISABLE KEYS */;
+/*!40000 ALTER TABLE `time_zone_transition` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `time_zone_transition_type`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `time_zone_transition_type` (
+  `Time_zone_id` int(10) unsigned NOT NULL,
+  `Transition_type_id` int(10) unsigned NOT NULL,
+  `Offset` int(11) NOT NULL DEFAULT '0',
+  `Is_DST` tinyint(3) unsigned NOT NULL DEFAULT '0',
+  `Abbreviation` char(8) NOT NULL DEFAULT '',
+  PRIMARY KEY (`Time_zone_id`,`Transition_type_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT='Time zone transition types';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `time_zone_transition_type` WRITE;
+/*!40000 ALTER TABLE `time_zone_transition_type` DISABLE KEYS */;
+/*!40000 ALTER TABLE `time_zone_transition_type` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `user`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `user` (
+  `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `User` char(16) COLLATE utf8_bin NOT NULL DEFAULT '',
+  `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '',
+  `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N',
+  `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '',
+  `ssl_cipher` blob NOT NULL,
+  `x509_issuer` blob NOT NULL,
+  `x509_subject` blob NOT NULL,
+  `max_questions` int(11) unsigned NOT NULL DEFAULT '0',
+  `max_updates` int(11) unsigned NOT NULL DEFAULT '0',
+  `max_connections` int(11) unsigned NOT NULL DEFAULT '0',
+  `max_user_connections` int(11) unsigned NOT NULL DEFAULT '0',
+  PRIMARY KEY (`Host`,`User`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='Users and global privileges';
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `user` WRITE;
+/*!40000 ALTER TABLE `user` DISABLE KEYS */;
+INSERT INTO `user` VALUES ('localhost','root','','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','Y','','','','',0,0,0,0),('localhost','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0),('%','','','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0),('127.0.0.1','u1','*556BEF296211C2AF58F53DA3EDDD0A3371B6ECD5','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0),('localhost','u1','*556BEF296211C2AF58F53DA3EDDD0A3371B6ECD5','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0),('localhost','u2','*8F5AC958192622AED07C928249FF6BF22EBCF45C','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0),('127.0.0.1','u2','*8F5AC958192622AED07C928249FF6BF22EBCF45C','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0),('%','u2','*8F5AC958192622AED07C928249FF6BF22EBCF45C','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','N','','','','',0,0,0,0);
+/*!40000 ALTER TABLE `user` ENABLE KEYS */;
+UNLOCK TABLES;
+
+/*!40000 DROP DATABASE IF EXISTS `ltpda`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `ltpda` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `ltpda`;
+DROP TABLE IF EXISTS `available_dbs`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `available_dbs` (
+  `id` int(10) NOT NULL AUTO_INCREMENT,
+  `db_name` varchar(50) NOT NULL,
+  `name` varchar(50) NOT NULL,
+  `description` text NOT NULL,
+  `version` int(11) DEFAULT '1',
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `database` (`db_name`)
+) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `available_dbs` WRITE;
+/*!40000 ALTER TABLE `available_dbs` DISABLE KEYS */;
+INSERT INTO `available_dbs` VALUES (1,'db1','db1','Test database one',1);
+/*!40000 ALTER TABLE `available_dbs` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `options`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `options` (
+  `name` varchar(50) NOT NULL,
+  `value` text NOT NULL,
+  PRIMARY KEY (`name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `options` WRITE;
+/*!40000 ALTER TABLE `options` DISABLE KEYS */;
+INSERT INTO `options` VALUES 
+  ('plot_path','/var/www/html/ltpdarepo/plots'),
+  ('robot_path','/var/www/html/ltpdarepo/ltpdareporobot.rb'),
+  ('version','2.4'),
+  ('mail_text','Hello\nA new account for the LTPDA project has been created for you.\n\nYour login data:\nUsername: %username%\nPassword: %password%\nProject URL: http://127.0.0.1/ltpda24//\n\nThe LTPDA project manager'),
+  ('mail_subject','New LTPDA-Account'),
+  ('project_url','http://127.0.0.1/ltpda24//'),
+  ('mail_text_reset','Hello\nYou asked to reset your password. You can login with this new password now. You can change it on your profile page.\n\nYour login data:\nUsername: %username%\nPassword: %password%\nProject URL: http://127.0.0.1/ltpda24//\n\nThe LTPDA project manager'),('mail_subject_reset','LTPDA-Account reset'),
+  ('ext_plot_path','http://127.0.0.1/ltpda24//plots'),
+  ('admin_mail','One User <u1@example.net>');
+/*!40000 ALTER TABLE `options` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `user_access`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `user_access` (
+  `user_id` int(10) NOT NULL,
+  `db_name` varchar(50) NOT NULL,
+  `select_priv` tinyint(1) NOT NULL DEFAULT '0',
+  `insert_priv` tinyint(1) NOT NULL DEFAULT '0',
+  `update_priv` tinyint(1) NOT NULL DEFAULT '0',
+  `delete_priv` tinyint(1) NOT NULL DEFAULT '0',
+  PRIMARY KEY (`user_id`,`db_name`)
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `user_access` WRITE;
+/*!40000 ALTER TABLE `user_access` DISABLE KEYS */;
+INSERT INTO `user_access` VALUES (1,'db1',1,1,0,0),(2,'db1',1,0,0,0);
+/*!40000 ALTER TABLE `user_access` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `user_hosts`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `user_hosts` (
+  `user_id` int(10) NOT NULL,
+  `hostname` varchar(100) NOT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `user_hosts` WRITE;
+/*!40000 ALTER TABLE `user_hosts` DISABLE KEYS */;
+INSERT INTO `user_hosts` VALUES (0,'localhost'),(0,'127.0.0.1'),(2,'%');
+/*!40000 ALTER TABLE `user_hosts` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `users`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `users` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `username` varchar(50) NOT NULL,
+  `password` varchar(50) NOT NULL,
+  `family_name` varchar(50) NOT NULL,
+  `given_name` varchar(50) NOT NULL,
+  `email` varchar(80) NOT NULL,
+  `institution` varchar(150) NOT NULL,
+  `telephone` varchar(50) NOT NULL,
+  `is_admin` tinyint(1) NOT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `users` WRITE;
+/*!40000 ALTER TABLE `users` DISABLE KEYS */;
+INSERT INTO `users` VALUES (1,'u1','*556BEF296211C2AF58F53DA3EDDD0A3371B6ECD5','User','One','u1@example.net','','',1),(2,'u2','*8F5AC958192622AED07C928249FF6BF22EBCF45C','User','Two','u2@example.net','Foo','00 123 4567890',0);
+/*!40000 ALTER TABLE `users` ENABLE KEYS */;
+UNLOCK TABLES;
+
+/*!40000 DROP DATABASE IF EXISTS `db1`*/;
+
+CREATE DATABASE /*!32312 IF NOT EXISTS*/ `db1` /*!40100 DEFAULT CHARACTER SET latin1 */;
+
+USE `db1`;
+DROP TABLE IF EXISTS `ao`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `ao` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `obj_id` int(11) DEFAULT NULL COMMENT 'ID of the object this data set belongs to',
+  `data_type` text COMMENT 'Data type of the object, see corresponding table',
+  `data_id` int(11) DEFAULT NULL COMMENT 'ID of the data set in the corresponding table',
+  `description` text COMMENT 'Description of the object',
+  `mfilename` text,
+  `mdlfilename` text,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `ao` WRITE;
+/*!40000 ALTER TABLE `ao` DISABLE KEYS */;
+/*!40000 ALTER TABLE `ao` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `bobjs`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `bobjs` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `obj_id` int(11) DEFAULT NULL COMMENT 'ID of the object this data set belongs to',
+  `mat` longblob COMMENT 'Binary version of the object',
+  PRIMARY KEY (`id`),
+  KEY `object_index` (`obj_id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `bobjs` WRITE;
+/*!40000 ALTER TABLE `bobjs` DISABLE KEYS */;
+/*!40000 ALTER TABLE `bobjs` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `cdata`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `cdata` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `xunits` text COMMENT 'Units of the x axis',
+  `yunits` text COMMENT 'Units of the y axis',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `cdata` WRITE;
+/*!40000 ALTER TABLE `cdata` DISABLE KEYS */;
+/*!40000 ALTER TABLE `cdata` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `collections`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `collections` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `nobjs` int(11) DEFAULT NULL COMMENT 'Number of objects in a collection',
+  `obj_ids` text COMMENT 'List of objects in a collection',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `collections` WRITE;
+/*!40000 ALTER TABLE `collections` DISABLE KEYS */;
+/*!40000 ALTER TABLE `collections` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `fsdata`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `fsdata` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `xunits` text COMMENT 'Units of the x axis',
+  `yunits` text COMMENT 'Units of the y axis',
+  `fs` double DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `fsdata` WRITE;
+/*!40000 ALTER TABLE `fsdata` DISABLE KEYS */;
+/*!40000 ALTER TABLE `fsdata` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `mfir`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `mfir` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `obj_id` int(11) DEFAULT NULL COMMENT 'The ID of the object this data set belongs to',
+  `in_file` text,
+  `fs` double DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `mfir` WRITE;
+/*!40000 ALTER TABLE `mfir` DISABLE KEYS */;
+/*!40000 ALTER TABLE `mfir` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `miir`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `miir` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `obj_id` int(11) DEFAULT NULL COMMENT 'ID of the object this data set belongs to',
+  `in_file` text,
+  `fs` double DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `miir` WRITE;
+/*!40000 ALTER TABLE `miir` DISABLE KEYS */;
+/*!40000 ALTER TABLE `miir` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `objmeta`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `objmeta` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'A unique ID of every data set in this table',
+  `obj_id` int(11) DEFAULT NULL COMMENT 'The ID of the object this data set belongs to',
+  `obj_type` text COMMENT 'Object type, e.g. ao, mfir, miir',
+  `name` text COMMENT 'Name of an object',
+  `created` datetime DEFAULT NULL COMMENT 'Creation time of an object',
+  `version` text COMMENT 'Version string of an object',
+  `ip` text COMMENT 'IP address of the creator',
+  `hostname` text COMMENT 'Hostname of the ceator',
+  `os` text COMMENT 'Operating system of the creator',
+  `submitted` datetime DEFAULT NULL COMMENT 'Submission time of an object',
+  `experiment_title` text COMMENT 'Experiment title',
+  `experiment_desc` text COMMENT 'Experiment description',
+  `analysis_desc` text COMMENT 'Analysis description',
+  `quantity` text COMMENT 'Quantity',
+  `additional_authors` text COMMENT 'Additional authors of an object',
+  `additional_comments` text COMMENT 'Additional comments to an object',
+  `keywords` text COMMENT 'Keywords',
+  `reference_ids` text COMMENT 'Reference IDs',
+  `validated` tinyint(4) DEFAULT NULL COMMENT 'Validated',
+  `vdate` datetime DEFAULT NULL COMMENT 'Validation time',
+  `author` text COMMENT 'Author of the object',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `objmeta` WRITE;
+/*!40000 ALTER TABLE `objmeta` DISABLE KEYS */;
+/*!40000 ALTER TABLE `objmeta` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `objs`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `objs` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every object in this database',
+  `xml` longtext COMMENT 'Raw XML representation of the object',
+  `uuid` text COMMENT 'Unique Global Identifier for this object',
+  `hash` text COMMENT 'MD5 hash of an object',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `objs` WRITE;
+/*!40000 ALTER TABLE `objs` DISABLE KEYS */;
+/*!40000 ALTER TABLE `objs` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `transactions`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `transactions` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `obj_id` int(11) DEFAULT NULL COMMENT 'ID of the object the transaction belongs to',
+  `user_id` int(11) DEFAULT NULL COMMENT 'ID of the User of the transactions',
+  `transdate` datetime DEFAULT NULL COMMENT 'Date and time of the transaction',
+  `direction` text COMMENT 'Direction of the transaction',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `transactions` WRITE;
+/*!40000 ALTER TABLE `transactions` DISABLE KEYS */;
+/*!40000 ALTER TABLE `transactions` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `tsdata`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `tsdata` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `xunits` text COMMENT 'Units of the x axis',
+  `yunits` text COMMENT 'Units of the y axis',
+  `fs` double DEFAULT NULL COMMENT 'Sample frequency [Hz]',
+  `nsecs` double DEFAULT NULL COMMENT 'Number of nanoseconds',
+  `t0` datetime DEFAULT NULL COMMENT 'Starting time of the time series',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `tsdata` WRITE;
+/*!40000 ALTER TABLE `tsdata` DISABLE KEYS */;
+/*!40000 ALTER TABLE `tsdata` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `users`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `users` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `firstname` text COMMENT 'The first name of the user',
+  `familyname` text COMMENT 'The family name of the user',
+  `username` text COMMENT 'The username/login of the user',
+  `email` text COMMENT 'The email address of the user',
+  `telephone` text COMMENT 'Telephone number of the user',
+  `institution` text COMMENT 'Institution of the user',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `users` WRITE;
+/*!40000 ALTER TABLE `users` DISABLE KEYS */;
+INSERT INTO `users` VALUES (1,'One','User','u1','u1@example.net','',''),(2,'Two','User','u2','u2@example.net','00 123 4567890','Foo');
+/*!40000 ALTER TABLE `users` ENABLE KEYS */;
+UNLOCK TABLES;
+DROP TABLE IF EXISTS `xydata`;
+/*!40101 SET @saved_cs_client     = @@character_set_client */;
+/*!40101 SET character_set_client = utf8 */;
+CREATE TABLE `xydata` (
+  `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Unique ID of every data set in this table',
+  `xunits` text COMMENT 'Units of the x axis',
+  `yunits` text COMMENT 'Units of the y axis',
+  PRIMARY KEY (`id`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1;
+/*!40101 SET character_set_client = @saved_cs_client */;
+
+LOCK TABLES `xydata` WRITE;
+/*!40000 ALTER TABLE `xydata` DISABLE KEYS */;
+/*!40000 ALTER TABLE `xydata` 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 */;
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/ltpdarepo/tests/test_schema.py	Tue Oct 11 17:47:52 2011 +0200
@@ -0,0 +1,173 @@
+import unittest2 as unittest
+import difflib
+import sys
+import os
+import warnings
+
+from contextlib import contextmanager
+from cStringIO import StringIO
+
+import MySQLdb as mysql
+import sqlalchemy
+
+from ltpdarepo.config import USERNAME, PASSWORD, HOSTNAME
+from ltpdarepo.admin import wipe, install, createdb, useradd, grant, upgrade
+
+
+class Formatter(object):
+    def __init__(self, out=sys.stdout):
+        self.level = 0
+        self.out = out
+
+    @contextmanager
+    def indent(self, increase=1):
+        self.level += increase
+        yield
+        self.level -= increase
+
+    def write(self, string):
+        self.out.write('  ' * self.level)
+        self.out.write(string)
+        self.out.write('\n')
+
+
+def dump_schema(database, out):
+    f = Formatter(out)
+    url = sqlalchemy.engine.url.URL('mysql', username=USERNAME, password=PASSWORD, host=HOSTNAME, database=database)
+    engine = sqlalchemy.engine.create_engine(url)
+    inspector = sqlalchemy.engine.reflection.Inspector.from_engine(engine)
+    dump_database(inspector, f)
+
+
+def dump_database(inspector, f):
+    f.write('db1')
+    with f.indent():
+        # tables
+        for table in inspector.get_table_names():
+            f.write('table: %s' % table)
+            with f.indent():
+                dump_table(inspector, table, f)
+        # views
+        for view in inspector.get_view_names():
+            f.write('view: %s' % view)
+            with f.indent():
+                dump_table(inspector, view, f)
+
+
+def dump_table(inspector, table, f):
+    # columns
+    f.write('columns:')
+    with f.indent():
+        for column in inspector.get_columns(table):
+            f.write('- %s' % column.pop('name'))
+            with f.indent():
+                for k, v in column.iteritems():
+                    f.write('%s: %s' % (k, v))
+    # primary keys
+    pks = inspector.get_primary_keys(table)
+    if pks:
+        f.write('primary keys:')
+        with f.indent():
+            for pk in pks:
+                f.write('- %s' % pk)
+    # foreign keys
+    fks = inspector.get_foreign_keys(table)
+    if fks:
+        f.write('foreign keys:')
+        with f.indent():
+            for fk in fks:
+                f.write('- %s' % fk.pop('name'))
+                fk.pop('options')
+                with f.indent():
+                    for k, v in fk.iteritems():
+                        if isinstance(v, list):
+                            v = ', '.join(map(unicode, v))
+                        f.write('%s: %s' % (k, v))
+    # indexes
+    indexes = inspector.get_indexes(table)
+    if indexes:
+        f.write('indexes:')
+        with f.indent():
+            for index in indexes:
+                f.write('- %s' % index.pop('name'))
+                with f.indent():
+                    for k, v in index.iteritems():
+                        if isinstance(v, list):
+                            v = ', '.join(map(unicode, v))
+                        f.write('%s: %s' % (k, v))
+    # options
+    options = inspector.get_table_options(table)
+    if options:
+        f.write('options:')
+        with f.indent():
+            for k, v in options.iteritems():
+                if k.startswith('mysql_'):
+                    k = k[6:]
+                f.write('- %s: %s' % (k, v))
+
+
+class TestCase(unittest.TestCase):
+
+    def test_repository_schema(self):
+        warnings.simplefilter('ignore', category=mysql.Warning)
+
+        wipe()
+
+        # load dump
+        conn = mysql.connect(host=HOSTNAME, db='', user=USERNAME, passwd=PASSWORD, charset='utf8')
+        curs = conn.cursor()
+        pwd = os.path.dirname(__file__)
+        sql = open(os.path.join(pwd, '..', 'sql', 'dump-v2.4.sql'))
+        for stmt in [x.strip() for x in sql.read().split(';\n')]:
+            if stmt:
+                curs.execute(stmt)
+        conn.commit()
+
+        # upgrade
+        upgrade()
+
+        curs = conn.cursor()
+
+        # no user accounts specified for host '127.0.0.1'
+        curs.execute("""SELECT Host FROM mysql.user WHERE User = 'u1'""")
+        hosts = sorted([row[0] for row in curs.fetchall()])
+        self.assertEqual(hosts, ['localhost'])
+        curs.execute("""SELECT Host FROM mysql.user WHERE User = 'u2'""")
+        hosts = sorted([row[0] for row in curs.fetchall()])
+        self.assertEqual(hosts, ['%', 'localhost'])
+
+        # curs.execute("""SELECT Db FROM mysql.db WHERE User = 'u2'""")
+        # dbs = [row[0] for row in curs.fetchall()]
+        # self.assertEqual(dbs, ['db1'])
+
+        # no explicit privileges on transactions table
+        curs.execute("""SELECT Table_name FROM mysql.tables_priv WHERE User = 'u2'""")
+        tables = [row[0] for row in curs.fetchall()]
+        self.assertEqual(tables, [])
+
+        # dump database structure
+        upgraded = StringIO()
+        dump_schema('ltpda', upgraded)
+        dump_schema('db1', upgraded)
+        upgraded.seek(0)
+
+        # install
+        wipe()
+        install()
+        useradd('u1', password='u1', name='One', surname='User', email='u1@example.net')
+        grant('u1', '%', ['admin', ])
+        createdb('db1', description=u'Test database one')
+        grant('u1', 'db1', ['select', 'insert', 'update', 'delete'])
+
+        # dump database structure
+        new = StringIO()
+        dump_schema('ltpda', new)
+        dump_schema('db1', new)
+        new.seek(0)
+
+        # compare
+        diff = difflib.unified_diff(upgraded.readlines(), new.readlines())
+        for line in diff:
+            sys.stdout.write(line)
+
+        self.assertTrue(upgraded.getvalue() == new.getvalue())