Add purge option.

This commit is contained in:
Albert Cervera i Areny 2017-01-21 00:57:41 +01:00
parent 3bad37818b
commit 716a9e0746
2 changed files with 11 additions and 3 deletions

View File

@ -88,9 +88,6 @@ after:
- comment: # Mark all categories as accounting type
tables: product_category
query: UPDATE product_category SET accounting = True;
- comment: # DROP category COLUMN
tables: product_template
query: ALTER TABLE product_template DROP COLUMN category;
- comment: # Set reconciliation date
tables: account_move_reconciliation
query: UPDATE account_move_reconciliation SET date=create_date WHERE date IS NULL;
@ -117,3 +114,8 @@ after:
script: migration_shipment_work.py
- tables: account_invoice_milestone
script: milestone_migration.py
purge:
- comment: Drop category column
fields: product_template.category
query: ALTER TABLE product_template DROP COLUMN category;

View File

@ -148,6 +148,8 @@ parser = argparse.ArgumentParser(description='Upgrade a Tryton database.')
parser.add_argument('database', nargs=1, help='PostgreSQL database to upgrade')
parser.add_argument('-c', '--config', default='trytond.conf',
help='path to the trytond configuration file')
parser.add_argument('-p', '--purge', action='store_true', dest='purge',
help='remove all fields that drop information')
args = parser.parse_args()
@ -172,6 +174,10 @@ else:
cursor = connection.cursor()
if args.purge:
process_actions(config.get('purge'))
connection.commit()
sys.exit(0)
print t.green('\nUninstalling modules...')
uninstall_modules()