TIMESTAMP column type has a special meaning for SQLServer, stable
authorAlexandre Fayolle <alexandre.fayolle@logilab.fr>
Mon, 14 Dec 2009 14:57:10 +0100
branchstable
changeset 4113 986fc01be83c
parent 4098 eb4722dd5f86
child 4114 a75a6e770717
TIMESTAMP column type has a special meaning for SQLServer, avoid using it for that driver (with help from logilab.common.adbh)
server/sources/native.py
--- a/server/sources/native.py	Mon Dec 14 10:45:14 2009 +0100
+++ b/server/sources/native.py	Mon Dec 14 14:57:10 2009 +0100
@@ -593,6 +593,7 @@
 
 def sql_schema(driver):
     helper = get_adv_func_helper(driver)
+    tstamp_col_type = helper.TYPE_MAPPING.get('TIMESTAMP', 'TIMESTAMP')
     schema = """
 /* Create the repository's system database */
 
@@ -602,7 +603,7 @@
   eid INTEGER PRIMARY KEY NOT NULL,
   type VARCHAR(64) NOT NULL,
   source VARCHAR(64) NOT NULL,
-  mtime TIMESTAMP NOT NULL,
+  mtime %s NOT NULL,
   extid VARCHAR(256)
 );
 CREATE INDEX entities_type_idx ON entities(type);
@@ -613,13 +614,13 @@
   eid INTEGER PRIMARY KEY NOT NULL,
   type VARCHAR(64) NOT NULL,
   source VARCHAR(64) NOT NULL,
-  dtime TIMESTAMP NOT NULL,
+  dtime %s NOT NULL,
   extid VARCHAR(256)
 );
 CREATE INDEX deleted_entities_type_idx ON deleted_entities(type);
 CREATE INDEX deleted_entities_dtime_idx ON deleted_entities(dtime);
 CREATE INDEX deleted_entities_extid_idx ON deleted_entities(extid);
-""" % helper.sql_create_sequence('entities_id_seq')
+""" % (helper.sql_create_sequence('entities_id_seq'), tstamp_col_type, tstamp_col_type)
     return schema