[GRASS-SVN] r43083 - grass/trunk/scripts/v.db.dropcolumn

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Aug 13 03:22:43 EDT 2010


Author: mlennert
Date: 2010-08-13 07:22:43 +0000 (Fri, 13 Aug 2010)
New Revision: 43083

Modified:
   grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
Log:
Recreate index on key column in sqlite database


Modified: grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py
===================================================================
--- grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2010-08-13 07:02:06 UTC (rev 43082)
+++ grass/trunk/scripts/v.db.dropcolumn/v.db.dropcolumn.py	2010-08-13 07:22:43 UTC (rev 43083)
@@ -105,11 +105,12 @@
 	    "DROP TABLE ${table}",
 	    "CREATE TABLE ${table}(${coldef})",
 	    "INSERT INTO ${table} SELECT ${colnames} FROM ${table}_backup",
+	    "CREATE UNIQUE INDEX ${table}_cat ON ${table} (${keycol} )",
 	    "DROP TABLE ${table}_backup",
 	    "COMMIT"
 	    ]
 	tmpl = string.Template(';\n'.join(cmds))
-	sql = tmpl.substitute(table = table, coldef = coltypes, colnames = colnames)
+	sql = tmpl.substitute(table = table, coldef = coltypes, colnames = colnames, keycol = keycol)
     else:
 	sql = "ALTER TABLE %s DROP COLUMN %s" % (table, column)
     



More information about the grass-commit mailing list