
/*
 * This is an auto-generated file.
 * Do not edit! All changes made to it will be lost.
 */


#include "akonadischema.h"

using namespace Akonadi::Server;

QList<TableDescription> AkonadiSchema::tables()
{
  QList<TableDescription> tabs;
  tabs.reserve(13);
  
  {
    TableDescription t;
    t.name = QStringLiteral("SchemaVersionTable");

    t.columns.reserve(2);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("version");
      c.type = QStringLiteral("int");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("0");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("generation");
      c.type = QStringLiteral("int");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("0");
      

      t.columns.push_back(c);
    }
    
      t.data.reserve(1);
      
      {
        const QStringList columns = QStringLiteral("version").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        const QStringList values = QStringLiteral("42").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        Q_ASSERT( columns.count() == values.count() );

        DataDescription d;
        for ( int i = 0; i < columns.size(); ++i ) {
          d.data.insert( columns.at( i ), values.at( i ) );
        }
        t.data.push_back(d);
      }
      

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("ResourceTable");

    t.columns.reserve(3);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("name");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      
      c.isUnique = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("isVirtual");
      c.type = QStringLiteral("bool");
      
      c.defaultValue = QStringLiteral("false");
      

      t.columns.push_back(c);
    }
    
      t.data.reserve(1);
      
      {
        const QStringList columns = QStringLiteral("name,isVirtual").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        const QStringList values = QStringLiteral("'akonadi_search_resource',true").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        Q_ASSERT( columns.count() == values.count() );

        DataDescription d;
        for ( int i = 0; i < columns.size(); ++i ) {
          d.data.insert( columns.at( i ), values.at( i ) );
        }
        t.data.push_back(d);
      }
      

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("CollectionTable");

    t.columns.reserve(19);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("remoteId");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("remoteRevision");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("name");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("parentId");
      c.type = QStringLiteral("qint64");
      
      c.refTable = QStringLiteral("Collection");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("resourceId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("Resource");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("enabled");
      c.type = QStringLiteral("bool");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("true");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("syncPref");
      c.type = QStringLiteral("Tristate");
      
      c.isEnum = true;
      
      c.defaultValue = QStringLiteral("Tristate::Undefined");
      
      c.enumValueMap = {
      
        { QStringLiteral("Tristate::False"),
            0 },
        { QStringLiteral("Tristate::True"),
            1 },
        { QStringLiteral("Tristate::Undefined"),
            2 }
      };
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("displayPref");
      c.type = QStringLiteral("Tristate");
      
      c.isEnum = true;
      
      c.defaultValue = QStringLiteral("Tristate::Undefined");
      
      c.enumValueMap = {
      
        { QStringLiteral("Tristate::False"),
            0 },
        { QStringLiteral("Tristate::True"),
            1 },
        { QStringLiteral("Tristate::Undefined"),
            2 }
      };
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("indexPref");
      c.type = QStringLiteral("Tristate");
      
      c.isEnum = true;
      
      c.defaultValue = QStringLiteral("Tristate::Undefined");
      
      c.enumValueMap = {
      
        { QStringLiteral("Tristate::False"),
            0 },
        { QStringLiteral("Tristate::True"),
            1 },
        { QStringLiteral("Tristate::Undefined"),
            2 }
      };
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("cachePolicyInherit");
      c.type = QStringLiteral("bool");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("true");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("cachePolicyCheckInterval");
      c.type = QStringLiteral("int");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("-1");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("cachePolicyCacheTimeout");
      c.type = QStringLiteral("int");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("-1");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("cachePolicySyncOnDemand");
      c.type = QStringLiteral("bool");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("false");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("cachePolicyLocalParts");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("queryString");
      c.type = QStringLiteral("QString");
      
      c.size = 32768;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("queryAttributes");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("queryCollections");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("isVirtual");
      c.type = QStringLiteral("bool");
      
      c.defaultValue = QStringLiteral("false");
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(7);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("parentAndNameIndex");
      idx.columns = QStringLiteral("parentId,name").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = true;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("parentIndex");
      idx.columns = QStringLiteral("parentId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("resourceIndex");
      idx.columns = QStringLiteral("resourceId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("enabledIndex");
      idx.columns = QStringLiteral("enabled").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("syncPrefIndex");
      idx.columns = QStringLiteral("syncPref").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("displayPrefIndex");
      idx.columns = QStringLiteral("displayPref").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("indexPrefIndex");
      idx.columns = QStringLiteral("indexPref").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
      t.data.reserve(1);
      
      {
        const QStringList columns = QStringLiteral("parentId,name,resourceId,isVirtual").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        const QStringList values = QStringLiteral("NULL,'Search',1,true").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        Q_ASSERT( columns.count() == values.count() );

        DataDescription d;
        for ( int i = 0; i < columns.size(); ++i ) {
          d.data.insert( columns.at( i ), values.at( i ) );
        }
        t.data.push_back(d);
      }
      

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("MimeTypeTable");

    t.columns.reserve(2);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("name");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      
      c.isUnique = true;
      

      t.columns.push_back(c);
    }
    

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("PimItemTable");

    t.columns.reserve(11);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("rev");
      c.type = QStringLiteral("int");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("0");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("remoteId");
      c.type = QStringLiteral("QString");
      
      c.size = 1024;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("remoteRevision");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("gid");
      c.type = QStringLiteral("QString");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("collectionId");
      c.type = QStringLiteral("qint64");
      
      c.refTable = QStringLiteral("Collection");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("mimeTypeId");
      c.type = QStringLiteral("qint64");
      
      c.refTable = QStringLiteral("MimeType");
      
      c.refColumn = QStringLiteral("id");
      
      c.onDelete = ColumnDescription::Restrict;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("datetime");
      c.type = QStringLiteral("QDateTime");
      
      c.defaultValue = QStringLiteral("QDateTime::currentDateTimeUtc()");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("atime");
      c.type = QStringLiteral("QDateTime");
      
      c.defaultValue = QStringLiteral("QDateTime::currentDateTimeUtc()");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("dirty");
      c.type = QStringLiteral("bool");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("size");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.defaultValue = QStringLiteral("0");
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(5);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("collectionIndex");
      idx.columns = QStringLiteral("collectionId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("mimeTypeIndex");
      idx.columns = QStringLiteral("mimeTypeId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("gidIndex");
      idx.columns = QStringLiteral("gid").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("ridIndex");
      idx.columns = QStringLiteral("remoteId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("idSortIndex");
      idx.columns = QStringLiteral("id").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      
      idx.sort = QStringLiteral("DESC");
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("FlagTable");

    t.columns.reserve(2);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("name");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      
      c.isUnique = true;
      

      t.columns.push_back(c);
    }
    

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("PartTypeTable");

    t.columns.reserve(3);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("name");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("ns");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(1);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("partTypeNameIndex");
      idx.columns = QStringLiteral("ns,name").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = true;
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("PartTable");

    t.columns.reserve(7);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("pimItemId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("PimItem");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("partTypeId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("PartType");
      
      c.refColumn = QStringLiteral("id");
      
      c.noUpdate = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("data");
      c.type = QStringLiteral("QByteArray");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("datasize");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("version");
      c.type = QStringLiteral("int");
      
      c.defaultValue = QStringLiteral("0");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("storage");
      c.type = QStringLiteral("Storage");
      
      c.isEnum = true;
      
      c.defaultValue = QStringLiteral("Internal");
      
      c.enumValueMap = {
      
        { QStringLiteral("Storage::Internal"),
            0 },
        { QStringLiteral("Storage::External"),
            1 },
        { QStringLiteral("Storage::Foreign"),
            2 }
      };
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(3);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("pimItemIdTypeIndex");
      idx.columns = QStringLiteral("pimItemId,partTypeId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = true;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("pimItemIdSortIndex");
      idx.columns = QStringLiteral("pimItemId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      
      idx.sort = QStringLiteral("DESC");
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("partTypeIndex");
      idx.columns = QStringLiteral("partTypeId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("CollectionAttributeTable");

    t.columns.reserve(4);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("collectionId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("Collection");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("type");
      c.type = QStringLiteral("QByteArray");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("value");
      c.type = QStringLiteral("QByteArray");
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(1);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("collectionIndex");
      idx.columns = QStringLiteral("collectionId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("TagTypeTable");

    t.columns.reserve(2);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("name");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      
      c.isUnique = true;
      

      t.columns.push_back(c);
    }
    
      t.data.reserve(1);
      
      {
        const QStringList columns = QStringLiteral("name").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        const QStringList values = QStringLiteral("'PLAIN'").split( QLatin1Char( ',' ), Qt::SkipEmptyParts );
        Q_ASSERT( columns.count() == values.count() );

        DataDescription d;
        for ( int i = 0; i < columns.size(); ++i ) {
          d.data.insert( columns.at( i ), values.at( i ) );
        }
        t.data.push_back(d);
      }
      

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("TagTable");

    t.columns.reserve(4);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("gid");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("parentId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = true;
      
      c.refTable = QStringLiteral("Tag");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("typeId");
      c.type = QStringLiteral("qint64");
      
      c.refTable = QStringLiteral("TagType");
      
      c.refColumn = QStringLiteral("id");
      
      c.defaultValue = QStringLiteral("1");
      
      c.onDelete = ColumnDescription::Restrict;
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(2);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("parentIndex");
      idx.columns = QStringLiteral("parentId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("typeIndex");
      idx.columns = QStringLiteral("typeId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("TagAttributeTable");

    t.columns.reserve(4);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("id");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.isAutoIncrement = true;
      
      c.isPrimaryKey = true;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("tagId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("Tag");
      
      c.refColumn = QStringLiteral("id");
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("type");
      c.type = QStringLiteral("QByteArray");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("value");
      c.type = QStringLiteral("QByteArray");
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(1);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("tagIndex");
      idx.columns = QStringLiteral("tagId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  {
    TableDescription t;
    t.name = QStringLiteral("TagRemoteIdResourceRelationTable");

    t.columns.reserve(3);
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("tagId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("Tag");
      
      c.refColumn = QStringLiteral("id");
      
      c.onDelete = ColumnDescription::Cascade;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("resourceId");
      c.type = QStringLiteral("qint64");
      
      c.allowNull = false;
      
      c.refTable = QStringLiteral("Resource");
      
      c.refColumn = QStringLiteral("id");
      
      c.onDelete = ColumnDescription::Cascade;
      

      t.columns.push_back(c);
    }
    
    {
      ColumnDescription c;
      c.name = QStringLiteral("remoteId");
      c.type = QStringLiteral("QString");
      
      c.allowNull = false;
      

      t.columns.push_back(c);
    }
    t.indexes.reserve(3);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("TagAndResourceIndex");
      idx.columns = QStringLiteral("tagId,resourceId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = true;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("tagIndex");
      idx.columns = QStringLiteral("tagId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("resourceIndex");
      idx.columns = QStringLiteral("resourceId").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      t.indexes.push_back(idx);
    }
  

    tabs.push_back(t);
  }
  
  return tabs;
}

QList<RelationDescription> AkonadiSchema::relations()
{
  QList<RelationDescription> rels;
  rels.reserve(4);
  
  {
    RelationDescription r;
    r.firstTable = QStringLiteral("PimItem");
    r.firstColumn = QStringLiteral("id");
    r.secondTable = QStringLiteral("Flag");
    r.secondColumn = QStringLiteral("id");
    r.indexes.reserve(1);
  
    {
      IndexDescription idx;
      idx.name = QStringLiteral("pimItemIdSortIndex");
      idx.columns = QStringLiteral("pimitem_id").split(QLatin1Char( ',' ), Qt::SkipEmptyParts);
      
      idx.isUnique = false;
      
      idx.sort = QStringLiteral("DESC");
      r.indexes.push_back(idx);
    }
  
    rels.push_back(r);

  }
  
  {
    RelationDescription r;
    r.firstTable = QStringLiteral("PimItem");
    r.firstColumn = QStringLiteral("id");
    r.secondTable = QStringLiteral("Tag");
    r.secondColumn = QStringLiteral("id");
    
    rels.push_back(r);

  }
  
  {
    RelationDescription r;
    r.firstTable = QStringLiteral("Collection");
    r.firstColumn = QStringLiteral("id");
    r.secondTable = QStringLiteral("MimeType");
    r.secondColumn = QStringLiteral("id");
    
    rels.push_back(r);

  }
  
  {
    RelationDescription r;
    r.firstTable = QStringLiteral("Collection");
    r.firstColumn = QStringLiteral("id");
    r.secondTable = QStringLiteral("PimItem");
    r.secondColumn = QStringLiteral("id");
    
    rels.push_back(r);

  }
  
  return rels;
}

