misc/migration/bootstrapmigration_repository.py
changeset 10074 ab956b780d4e
parent 10025 7b72ecc3f4d2
parent 10058 d47c318f95b2
child 10272 3231fd2fa7a5
equal deleted inserted replaced
10068:1b0cb3c6c95e 10074:ab956b780d4e
    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