[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    kdesupport/akonadi/server
From:       Volker Krause <vkrause () kde ! org>
Date:       2010-07-15 7:30:05
Message-ID: 20100715073005.399F2AC73B () svn ! kde ! org
[Download RAW message or body]

SVN commit 1150146 by vkrause:

Try to unbreak postgres database creation and thus a whole bunch of
kdepimlibs unit tests.


 M  +11 -9     src/storage/dbinitializer_p.cpp  
 M  +1 -1      tests/unittest/dbinitializertest_data/psql_ct_collection  
 M  +1 -1      tests/unittest/dbinitializertest_data/psql_ct_collectionattribute  
 M  +2 -2      tests/unittest/dbinitializertest_data/psql_ct_flag  
 M  +2 -2      tests/unittest/dbinitializertest_data/psql_ct_mimetype  
 M  +1 -1      tests/unittest/dbinitializertest_data/psql_ct_part  
 M  +1 -1      tests/unittest/dbinitializertest_data/psql_ct_pimitem  
 M  +2 -2      tests/unittest/dbinitializertest_data/psql_ct_resource  


--- trunk/kdesupport/akonadi/server/src/storage/dbinitializer_p.cpp #1150145:1150146
@@ -217,19 +217,21 @@
 
 QString DbInitializerPostgreSql::buildColumnStatement( const ColumnDescription \
&columnDescription ) const  {
-  QString column = columnDescription.name;
+  QString column = columnDescription.name + QLatin1Char( ' ' );
 
-  column += QLatin1Char( ' ' ) + sqlType( columnDescription.type );
+  if ( columnDescription.isAutoIncrement )
+    column += QLatin1String( "SERIAL" );
+  else
+    column += sqlType( columnDescription.type );
 
-  if ( !columnDescription.allowNull )
+  if ( columnDescription.isPrimaryKey )
+    column += QLatin1String( " PRIMARY KEY" );
+  else if ( columnDescription.isUnique )
+    column += QLatin1String( " UNIQUE" );
+
+  if ( !columnDescription.allowNull && !columnDescription.isPrimaryKey )
     column += QLatin1String( " NOT NULL" );
 
-  if ( columnDescription.isPrimaryKey && columnDescription.isAutoIncrement )
-    column += QLatin1String( " SERIAL PRIMARY KEY" );
-
-  if ( columnDescription.isUnique )
-    column += QLatin1String( " UNIQUE" );
-
   if ( !columnDescription.refTable.isEmpty() && \
                !columnDescription.refColumn.isEmpty() ) {
     column += QString::fromLatin1( " REFERENCES %1Table(%2) ON DELETE CASCADE ON \
                UPDATE CASCADE" )
                                  .arg( columnDescription.refTable )
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_collection \
#1150145:1150146 @@ -1,4 +1,4 @@
-CREATE TABLE CollectionTable (id int8 NOT NULL SERIAL PRIMARY KEY,
+CREATE TABLE CollectionTable (id SERIAL PRIMARY KEY,
                               remoteId TEXT,
                               remoteRevision TEXT,
                               name TEXT NOT NULL,
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_collectionattribute \
#1150145:1150146 @@ -1,4 +1,4 @@
-CREATE TABLE CollectionAttributeTable (id int8 NOT NULL SERIAL PRIMARY KEY,
+CREATE TABLE CollectionAttributeTable (id SERIAL PRIMARY KEY,
                                        collectionId int8 NOT NULL REFERENCES \
CollectionTable(id) ON DELETE CASCADE ON UPDATE CASCADE,  type BYTEA NOT NULL,
                                        value BYTEA)
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_flag \
#1150145:1150146 @@ -1,2 +1,2 @@
-CREATE TABLE FlagTable (id int8 NOT NULL SERIAL PRIMARY KEY,
-                        name TEXT NOT NULL UNIQUE)
+CREATE TABLE FlagTable (id SERIAL PRIMARY KEY,
+                        name TEXT UNIQUE NOT NULL)
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_mimetype \
#1150145:1150146 @@ -1,2 +1,2 @@
-CREATE TABLE MimeTypeTable (id int8 NOT NULL SERIAL PRIMARY KEY,
-                            name TEXT NOT NULL UNIQUE)
+CREATE TABLE MimeTypeTable (id SERIAL PRIMARY KEY,
+                            name TEXT UNIQUE NOT NULL)
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_part \
#1150145:1150146 @@ -1,4 +1,4 @@
-CREATE TABLE PartTable (id int8 NOT NULL SERIAL PRIMARY KEY,
+CREATE TABLE PartTable (id SERIAL PRIMARY KEY,
                         pimItemId int8 NOT NULL REFERENCES PimItemTable(id) ON \
DELETE CASCADE ON UPDATE CASCADE,  name TEXT NOT NULL,
                         data BYTEA,
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_pimitem \
#1150145:1150146 @@ -1,4 +1,4 @@
-CREATE TABLE PimItemTable (id int8 NOT NULL SERIAL PRIMARY KEY,
+CREATE TABLE PimItemTable (id SERIAL PRIMARY KEY,
                            rev INTEGER NOT NULL DEFAULT 0,
                            remoteId TEXT,
                            remoteRevision TEXT,
--- trunk/kdesupport/akonadi/server/tests/unittest/dbinitializertest_data/psql_ct_resource \
#1150145:1150146 @@ -1,3 +1,3 @@
-CREATE TABLE ResourceTable (id int8 NOT NULL SERIAL PRIMARY KEY,
-                            name TEXT NOT NULL UNIQUE,
+CREATE TABLE ResourceTable (id SERIAL PRIMARY KEY,
+                            name TEXT UNIQUE NOT NULL,
                             isVirtual BOOL DEFAULT false)


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic