Browse Source

Recreate index on key column in sqlite database

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@43083 15284696-431f-4ddb-bdfa-cd5b030d7da7
Moritz Lennert 14 years ago
parent
commit
32ea90f59c
1 changed files with 2 additions and 1 deletions
  1. 2 1
      scripts/v.db.dropcolumn/v.db.dropcolumn.py

+ 2 - 1
scripts/v.db.dropcolumn/v.db.dropcolumn.py

@@ -105,11 +105,12 @@ def main():
 	    "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)