misc/migration/bootstrapmigration_repository.py
changeset 10058 d47c318f95b2
parent 9708 b36bc18f6ef7
child 10074 ab956b780d4e
child 10270 1ae64186af94
equal deleted inserted replaced
10047:a1fde2d343b6 10058:d47c318f95b2
    48     cursor.execute(dbh.sql_create_numrange('entities_id_seq'))
    48     cursor.execute(dbh.sql_create_numrange('entities_id_seq'))
    49     cursor.execute(dbh.sql_restart_numrange('entities_id_seq', initial_value=lasteid))
    49     cursor.execute(dbh.sql_restart_numrange('entities_id_seq', initial_value=lasteid))
    50     session.commit()
    50     session.commit()
    51 
    51 
    52 if applcubicwebversion < (3, 19, 0) and cubicwebversion >= (3, 19, 0):
    52 if applcubicwebversion < (3, 19, 0) and cubicwebversion >= (3, 19, 0):
    53     sql('ALTER TABLE "entities" DROP COLUMN "mtime"')
    53     try: 
    54     sql('ALTER TABLE "entities" DROP COLUMN "source"')
    54         # need explicit drop of the indexes on some database systems (sqlserver)
       
    55         sql(repo.system_source.dbhelper.sql_drop_index('entities', 'mtime'))
       
    56         sql('ALTER TABLE "entities" DROP COLUMN "mtime"')
       
    57         sql('ALTER TABLE "entities" DROP COLUMN "source"')
       
    58     except: # programming error, already migrated
       
    59         print "Failed to drop mtime or source database columns"
       
    60         print "'entities' table of the database has probably been already updated"
    55 
    61 
    56     commit()
    62     commit()
    57 
    63 
    58     replace_eid_sequence_with_eid_numrange(session)
    64     replace_eid_sequence_with_eid_numrange(session)
    59 
    65