commit 4d58ef6a8ae2f665ec083b45d30568cac0b67e34
Author: Christian Ehringfeld <c.ehringfeld@t-online.de>
Date:   Mon Mar 23 14:00:39 2015 +0100

    some stuff

diff --git a/EntityManager.pro b/EntityManager.pro
index 60d5015..79bf3d2 100644
--- a/EntityManager.pro
+++ b/EntityManager.pro
@@ -18,15 +18,22 @@ src/entity.h \
     src/entitymanager.h \
     src/database.h \
     src/enums/databasetype.h \
-    src/schema.h
+    src/schema.h \
+    src/schema/sqliteschema.h \
+    src/tableschema.h \
+    src/columnschema.h
 
 SOURCES += \
-src/base/entity.cpp \
+src/entity.cpp \
     src/entitymanager.cpp \
     src/database.cpp \
-    src/schema.cpp
+    src/schema.cpp \
+    src/schema/sqliteschema.cpp \
+    src/tableschema.cpp \
+    src/columnschema.cpp
 
 unix {
     target.path = /usr/lib
     INSTALLS += target
 }
+CONFIG += c++11
diff --git a/src/columnschema.cpp b/src/columnschema.cpp
new file mode 100644
index 0000000..5ca9c8c
--- /dev/null
+++ b/src/columnschema.cpp
@@ -0,0 +1,107 @@
+#include "columnschema.h"
+using namespace CuteEntityManager;
+
+ColumnSchema::ColumnSchema() {
+
+}
+
+ColumnSchema::~ColumnSchema() {
+
+}
+
+QString ColumnSchema::getName() const {
+    return name;
+}
+
+void ColumnSchema::setName(const QString &value) {
+    name = value;
+}
+
+bool ColumnSchema::getAllowNull() const {
+    return allowNull;
+}
+
+void ColumnSchema::setAllowNull(bool value) {
+    allowNull = value;
+}
+
+QString ColumnSchema::getDbType() const {
+    return dbType;
+}
+
+void ColumnSchema::setDbType(const QString &value) {
+    dbType = value;
+}
+
+QString ColumnSchema::getDefaultValue() const {
+    return defaultValue;
+}
+
+void ColumnSchema::setDefaultValue(const QString &value) {
+    defaultValue = value;
+}
+
+QList<QString> ColumnSchema::getEnumValues() const {
+    return enumValues;
+}
+
+void ColumnSchema::setEnumValues(const QList<QString> &value) {
+    enumValues = value;
+}
+
+quint8 ColumnSchema::getSize() const {
+    return size;
+}
+
+void ColumnSchema::setSize(const quint8 &value) {
+    size = value;
+}
+
+quint8 ColumnSchema::getPrecision() const {
+    return precision;
+}
+
+void ColumnSchema::setPrecision(const quint8 &value) {
+    precision = value;
+}
+
+quint8 ColumnSchema::getScale() const {
+    return scale;
+}
+
+void ColumnSchema::setScale(const quint8 &value) {
+    scale = value;
+}
+
+bool ColumnSchema::getPrimaryKey() const {
+    return primaryKey;
+}
+
+void ColumnSchema::setPrimaryKey(bool value) {
+    primaryKey = value;
+}
+
+bool ColumnSchema::getAutoIncrement() const {
+    return autoIncrement;
+}
+
+void ColumnSchema::setAutoIncrement(bool value) {
+    autoIncrement = value;
+}
+
+bool ColumnSchema::getUnsignedColumn() const {
+    return unsignedColumn;
+}
+
+void ColumnSchema::setUnsignedColumn(bool value) {
+    unsignedColumn = value;
+}
+
+QString ColumnSchema::getComment() const {
+    return comment;
+}
+
+void ColumnSchema::setComment(const QString &value) {
+    comment = value;
+}
+
diff --git a/src/columnschema.h b/src/columnschema.h
new file mode 100644
index 0000000..ee6bf7d
--- /dev/null
+++ b/src/columnschema.h
@@ -0,0 +1,63 @@
+#ifndef COLUMNSCHEMA_H
+#define COLUMNSCHEMA_H
+#include <QString>
+
+namespace CuteEntityManager {
+
+class ColumnSchema
+{
+public:
+    ColumnSchema();
+    ~ColumnSchema();
+    QString getName() const;
+    void setName(const QString &value);
+
+    bool getAllowNull() const;
+    void setAllowNull(bool value);
+
+    QString getDbType() const;
+    void setDbType(const QString &value);
+
+    QString getDefaultValue() const;
+    void setDefaultValue(const QString &value);
+
+    QList<QString> getEnumValues() const;
+    void setEnumValues(const QList<QString> &value);
+
+    quint8 getSize() const;
+    void setSize(const quint8 &value);
+
+    quint8 getPrecision() const;
+    void setPrecision(const quint8 &value);
+
+    quint8 getScale() const;
+    void setScale(const quint8 &value);
+
+    bool getPrimaryKey() const;
+    void setPrimaryKey(bool value);
+
+    bool getAutoIncrement() const;
+    void setAutoIncrement(bool value);
+
+    bool getUnsignedColumn() const;
+    void setUnsignedColumn(bool value);
+
+    QString getComment() const;
+    void setComment(const QString &value);
+
+private:
+    QString name;
+    bool allowNull;
+    QString dbType;
+    QString defaultValue;
+    QList<QString> enumValues;
+    quint8 size;
+    quint8 precision;
+    quint8 scale;
+    bool primaryKey;
+    bool autoIncrement;
+    bool unsignedColumn;
+    QString comment;
+};
+}
+#endif // COLUMNSCHEMA_H
diff --git a/src/database.cpp b/src/database.cpp
index a7b8323..fd13b99 100644
--- a/src/database.cpp
+++ b/src/database.cpp
@@ -55,11 +55,11 @@ void Database::init() {
 DatabaseType Database::getDatabaseType() {
     QString d = this->database.driverName();
     if(d == "qmysql") {
-        return OpenTeacherTool::MYSQL;
+        return CuteEntityManager::MYSQL;
     } else if(d == "qpgsql") {
-        return OpenTeacherTool::PGSQL;
+        return CuteEntityManager::PGSQL;
     } else {
-        return OpenTeacherTool::SQLITE;
+        return CuteEntityManager::SQLITE;
     }
 }
 
@@ -87,17 +87,13 @@ void Database::setTableList(QSqlQuery &q) {
 }
 
 
-QString Database::sqliteTableList() {
-    return "SELECT tbl_name FROM sqlite_master WHERE type='table';";
-}
-
-QString Database::mysqlTableList() {
-    return "SHOW TABLES;";
-}
+//QString Database::mysqlTableList() {
+//    return "SHOW TABLES;";
+//}
 
-QString Database::pgsqlTableList() {
-    return "SELECT table_name FROM information_schema.tables WHERE table_catalog = '"+this->database.databaseName()+"';";
-}
+//QString Database::pgsqlTableList() {
+//    return "SELECT table_name FROM information_schema.tables WHERE table_catalog = '"+this->database.databaseName()+"';";
+//}
 
 Database::~Database() {
     if(this->database.isOpen()) {
diff --git a/src/entity.cpp b/src/entity.cpp
index 19f2e10..82ea0e7 100644
--- a/src/entity.cpp
+++ b/src/entity.cpp
@@ -1,31 +1,25 @@
 /*
-    Base class for all models
-    Copyright (C) 2013 Christian Ehringfeld <c.ehringfeld@t-online.de>
-
-    This file is part of OpenTeacherTool.
-
-    OpenTeacherTool is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    OpenTeacherTool is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with OpenTeacherTool.  If not, see <http://www.gnu.org/licenses/>.
-*/
+ * Copyright (C) 2015 Christian Ehringfeld <c.ehringfeld@t-online.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+ * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ */
 
 #include "entity.h"
 
-namespace OpenTeacherTool {
+namespace CuteEntityManager {
 
-Entity::Entity() {
+Entity::Entity() : QObject(){
     this->id = -1;
-    this->relations = new QHash<QString,Entity*>();
-    this->attributeValues = new QHash<QString, QVariant>();
 }
 
 qint64 Entity::getId() {
@@ -33,20 +27,10 @@ qint64 Entity::getId() {
 }
 
 void Entity::setId(qint64 id) {
-        this->id = id;
+    this->id = id;
 }
 
 Entity::~Entity() {
-    delete this->relations;
-    delete this->attributeValues;
-}
-
-Entity* Entity::getEntity() {
-    return this;
-}
-
-QString Entity::idColumnSQL() {
-    return "id BIGINT NOT NULL";
 }
 
 //QHash<QString, QString> OpenTeacherTool::Entity::getProperties(Datebasetype t) {
diff --git a/src/entity.h b/src/entity.h
index c14f45f..a768e3d 100644
--- a/src/entity.h
+++ b/src/entity.h
@@ -20,7 +20,6 @@
 #include <QMap>
 #include <QDebug>
 #include <QObject>
-#include "enums/persistencetype.h"
 #include "enums/databasetype.h"
 namespace CuteEntityManager {
 
diff --git a/src/entitymanager.cpp b/src/entitymanager.cpp
index fe25793..279debd 100644
--- a/src/entitymanager.cpp
+++ b/src/entitymanager.cpp
@@ -15,15 +15,12 @@
  */
 
 #include "entitymanager.h"
-
+using namespace CuteEntityManager;
 /**
  * Relationen fehlen noch
  * Fehlermeldungen erstellen am besten eine Exception Klasse diesbzgl. erstellen
  */
 
-namespace CuteEntityManager {
-
-
 QStringList EntityManager::connectionNames = QStringList();
 
 EntityManager::EntityManager(QSqlDatabase database) {
@@ -291,6 +288,5 @@ bool EntityManager::createTable(Entity *entity) {
         }
     }
     return rc;
-}
 
 }
diff --git a/src/schema.cpp b/src/schema.cpp
index 645b383..498c062 100644
--- a/src/schema.cpp
+++ b/src/schema.cpp
@@ -1,12 +1,11 @@
 #include "schema.h"
+using namespace CuteEntityManager;
 
-Schema::Schema()
-{
+Schema::Schema() {
 
 }
 
-Schema::~Schema()
-{
+Schema::~Schema() {
 
 }
 
diff --git a/src/schema.h b/src/schema.h
index 6277d0e..754bddf 100644
--- a/src/schema.h
+++ b/src/schema.h
@@ -1,12 +1,21 @@
 #ifndef SCHEMA_H
 #define SCHEMA_H
+#include <QString>
+#include "tableschema.h"
 
+namespace CuteEntityManager {
 
-class Schema
-{
+class Schema {
 public:
     Schema();
     ~Schema();
-};
+protected:
+    virtual QList<QString> findTableNames(QString schema = "");
+    virtual QList<QString> findUniqueIndexes(QString tableName);
+    virtual TableSchema findConstraints(TableSchema ts);
+    virtual QString getCreateTableSql(TableSchema ts);
+   virtual bool findColumns(TableSchema ts);
 
+};
+}
 #endif // SCHEMA_H
diff --git a/src/schema.h.autosave b/src/schema.h.autosave
new file mode 100644
index 0000000..6152d09
--- /dev/null
+++ b/src/schema.h.autosave
@@ -0,0 +1,22 @@
+#ifndef SCHEMA_H
+#define SCHEMA_H
+#include <QString>
+#include "tableschema.h"
+
+namespace CuteEntityManager {
+
+class Schema {
+public:
+    Schema();
+    ~Schema();
+protected:
+    virtual QList<QString> findTableNames(QString schema = "");
+    virtual QList<QString> findUniqueIndexes(QString tableName);
+    virtual TableSchema findConstraints(TableSchema ts);
+    virtual QString getCreateTableSql(TableSchema ts);
+   virtual bool findColumns(TableSchema ts);
+    
+
+};
+}
+#endif // SCHEMA_H
diff --git a/src/schema/sqliteschema.cpp b/src/schema/sqliteschema.cpp
new file mode 100644
index 0000000..1e5378b
--- /dev/null
+++ b/src/schema/sqliteschema.cpp
@@ -0,0 +1,15 @@
+#include "sqliteschema.h"
+
+SqliteSchema::SqliteSchema() : parent() {
+
+}
+
+SqliteSchema::~SqliteSchema()
+{
+
+}
+
+
+QString Database::sqliteTableList() {
+    return "SELECT tbl_name FROM sqlite_master WHERE type='table';";
+}
diff --git a/src/schema/sqliteschema.h b/src/schema/sqliteschema.h
new file mode 100644
index 0000000..e269928
--- /dev/null
+++ b/src/schema/sqliteschema.h
@@ -0,0 +1,12 @@
+#ifndef SQLITESCHEMA_H
+#define SQLITESCHEMA_H
+
+#include "../schema.h"
+namespace CuteEntityManager {
+class SqliteSchema : public Schema {
+public:
+    SqliteSchema();
+    ~SqliteSchema();
+};
+}
+#endif // SQLITESCHEMA_H
diff --git a/src/tableschema.cpp b/src/tableschema.cpp
new file mode 100644
index 0000000..b365386
--- /dev/null
+++ b/src/tableschema.cpp
@@ -0,0 +1,12 @@
+#include "tableschema.h"
+
+TableSchema::TableSchema()
+{
+
+}
+
+TableSchema::~TableSchema()
+{
+
+}
+
diff --git a/src/tableschema.h b/src/tableschema.h
new file mode 100644
index 0000000..3df5c0a
--- /dev/null
+++ b/src/tableschema.h
@@ -0,0 +1,13 @@
+#ifndef TABLESCHEMA_H
+#define TABLESCHEMA_H
+
+namespace CuteEntityManager {
+
+class TableSchema {
+public:
+    TableSchema();
+    ~TableSchema();
+};
+
+}
+#endif // TABLESCHEMA_H
diff --git a/src/tableschema.h.autosave b/src/tableschema.h.autosave
new file mode 100644
index 0000000..8021ac6
--- /dev/null
+++ b/src/tableschema.h.autosave
@@ -0,0 +1,16 @@
+#ifndef TABLESCHEMA_H
+#define TABLESCHEMA_H
+
+namespace CuteEntityManager {
+
+class TableSchema {
+public:
+    TableSchema();
+    ~TableSchema();
+    
+    
+    
+};
+
+}
+#endif // TABLESCHEMA_H
