summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Vrátil <dvratil@kde.org>2016-09-08 10:40:22 (GMT)
committerDaniel Vrátil <dvratil@kde.org>2016-09-08 10:40:23 (GMT)
commit9e0e38adbbbad6bee1196192a55824bc620b230a (patch)
treefc6770c15a45b3fc1ce7a40df6997c4b82ab9ed7
parent37817e26d88a777d45dcb624a0766a91e73c8bdf (diff)
Don't hardcode identifiers in pre-defined values in akonadidb.xml
PostgreSQL does not increment the internal autoincrement counter for primary keys if the key value is explicitly specified in INSERT statement.
-rw-r--r--src/server/storage/akonadidb.xml6
-rw-r--r--src/server/storage/dbupdate.xml4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/server/storage/akonadidb.xml b/src/server/storage/akonadidb.xml
index 092e0be..ed71af9 100644
--- a/src/server/storage/akonadidb.xml
+++ b/src/server/storage/akonadidb.xml
@@ -66,7 +66,7 @@
<table name="SchemaVersion">
<comment>Contains the schema version of the database.</comment>
<column name="version" type="int" default="0" allowNull="false"/>
- <data columns="version" values="32"/>
+ <data columns="version" values="33"/>
</table>
<table name="Resource">
@@ -181,7 +181,7 @@
<table name="TagType">
<column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/>
<column name="name" type="QString" allowNull="false" isUnique="true"/>
- <data columns="id,name" values="1,'PLAIN'"/>
+ <data columns="name" values="'PLAIN'"/>
</table>
<table name="Tag">
@@ -209,7 +209,7 @@
<table name="RelationType">
<column name="id" type="qint64" allowNull="false" isAutoIncrement="true" isPrimaryKey="true"/>
<column name="name" type="QString" allowNull="false" isUnique="true"/>
- <data columns="id,name" values="1,'GENERIC'"/>
+ <data columns="name" values="'GENERIC'"/>
</table>
<table name="Relation" identificationColumn="">
diff --git a/src/server/storage/dbupdate.xml b/src/server/storage/dbupdate.xml
index 923086a..653b8e0 100644
--- a/src/server/storage/dbupdate.xml
+++ b/src/server/storage/dbupdate.xml
@@ -316,4 +316,8 @@
WHERE PimItemTable.id IS NULL) x)
</raw-sql>
</update>
+ <update version="33" abortOnFailure="false">
+ <raw-sql backends="psql">SELECT setval('tagtypetable_pkey', (SELECT max(id) FROM TagTypeTable))</raw-sql>
+ <raw-sql backends="psql">SELECT setval('relationtypetable_pkey', (SELECT max(id) FROM RelationTypeTable))</raw-sql>
+ </update>
</updates>