misc/migration/bootstrapmigration_repository.py
changeset 10074 ab956b780d4e
parent 10025 7b72ecc3f4d2
parent 10058 d47c318f95b2
child 10272 3231fd2fa7a5
--- a/misc/migration/bootstrapmigration_repository.py	Wed Jul 30 22:26:18 2014 +0200
+++ b/misc/migration/bootstrapmigration_repository.py	Mon Dec 01 11:13:10 2014 +0100
@@ -50,8 +50,14 @@
     session.commit()
 
 if applcubicwebversion < (3, 19, 0) and cubicwebversion >= (3, 19, 0):
-    sql('ALTER TABLE "entities" DROP COLUMN "mtime"')
-    sql('ALTER TABLE "entities" DROP COLUMN "source"')
+    try: 
+        # need explicit drop of the indexes on some database systems (sqlserver)
+        sql(repo.system_source.dbhelper.sql_drop_index('entities', 'mtime'))
+        sql('ALTER TABLE "entities" DROP COLUMN "mtime"')
+        sql('ALTER TABLE "entities" DROP COLUMN "source"')
+    except: # programming error, already migrated
+        print "Failed to drop mtime or source database columns"
+        print "'entities' table of the database has probably been already updated"
 
     commit()