Changeset 1304

Show
Ignore:
Timestamp:
09/27/06 00:51:04 (2 years ago)
Author:
pacopablo
Message:

SqliteToPgScript:

  • Fixed bug where the ticket_id_seq and report_id_seq weren't being set properly.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • sqlitetopgscript/0.10/sqlite2pg

    r1264 r1304  
    101101        self.pgdb.commit() 
    102102        return row_exists > 0 
     103 
     104    def migrate_TICKET(self): 
     105        """ Migrate the ticket table and adjust the sequences properly """ 
     106        self.default_copy('ticket') 
     107        select_maxticket = "SELECT max(id) FROM ticket" 
     108        pgcur = self.pgdb.cursor() 
     109        pgcur.execute(select_maxticket) 
     110        r = pgcur.fetchone() 
     111        if r: 
     112            pgcur.execute("SELECT setval('ticket_id_seq', %s)", r) 
     113        self.pgdb.commit() 
     114         
     115    def migrate_REPORT(self): 
     116        """ Migrate the report table and adjust the sequences properly """ 
     117        self.default_copy('report') 
     118        select_maxreport = "SELECT max(id) FROM report" 
     119        pgcur = self.pgdb.cursor() 
     120        pgcur.execute(select_maxreport) 
     121        r = pgcur.fetchone() 
     122        if r: 
     123            pgcur.execute("SELECT setval('report_id_seq', %s)", r) 
     124        self.pgdb.commit() 
    103125     
    104126    def migrate_PERMISSION(self): 
     
    307329if __name__ == '__main__': 
    308330    opts = doArgs() 
    309     rc = Main(opts) 
    310     sys.exit(rc
     331    Main(opts) 
     332    sys.exit(0
    311333