浏览代码

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 年之前
父节点
当前提交
32ea90f59c
共有 1 个文件被更改,包括 2 次插入1 次删除
  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}",
 	    "DROP TABLE ${table}",
 	    "CREATE TABLE ${table}(${coldef})",
 	    "CREATE TABLE ${table}(${coldef})",
 	    "INSERT INTO ${table} SELECT ${colnames} FROM ${table}_backup",
 	    "INSERT INTO ${table} SELECT ${colnames} FROM ${table}_backup",
+	    "CREATE UNIQUE INDEX ${table}_cat ON ${table} (${keycol} )",
 	    "DROP TABLE ${table}_backup",
 	    "DROP TABLE ${table}_backup",
 	    "COMMIT"
 	    "COMMIT"
 	    ]
 	    ]
 	tmpl = string.Template(';\n'.join(cmds))
 	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:
     else:
 	sql = "ALTER TABLE %s DROP COLUMN %s" % (table, column)
 	sql = "ALTER TABLE %s DROP COLUMN %s" % (table, column)