Edgewall Software

Changes between Version 10 and Version 11 of TracFaq


Ignore:
Timestamp:
Mar 5, 2014, 1:57:00 AM (10 years ago)
Author:
Ryan J Ollos
Comment:

Better script for running db28.py, from th:comment:2:ticket:11151.

Legend:

Unmodified
Added
Removed
Modified
  • TracFaq

    v10 v11  
    7777**A:** Most likely db28.py failed. See #11370. Please report any additional information on the MailingList.
    7878
    79 You can try to create a `rundb28.py` script:
     79You can try to create a `run-db28.py` script:
    8080{{{#!python
    81 #!/usr/bin/python
     81# -*- coding: utf-8 -*-
     82#
     83# Execute `do_upgrade` in trac/upgrades/db28.py
     84#
     85# Usage: python run-db28.py /path/to/tracenv
     86#
     87
    8288from __future__ import with_statement
    83 import sys
    84 from trac.env import open_environment
    85 from trac.upgrades.db28 import do_upgrade
    8689
    87 env = open_environment(sys.argv[1])
    88 print 'Fixing attachments for environment', env.project_name, 'at', sys.argv[1]
    89 with env.db_transaction as db:
    90         cursor = db.cursor()
    91         do_upgrade(env, None, cursor)
    92         db.commit()
     90from trac.env import Environment
     91from trac.upgrades import db28
     92
     93def main(args):
     94    for arg in args:
     95        env = Environment(arg)
     96        with env.db_transaction as db:
     97            cursor = db.cursor()
     98            db28.do_upgrade(env, 28, cursor)
     99
     100if __name__ == '__main__':
     101    import sys
     102    main(sys.argv[1:])
    93103}}}
    94104