Require version number of the database being migrated from.
This commit is contained in:
parent
2ae9ac9efe
commit
702f63d1b6
15
config.yml
15
config.yml
|
@ -54,19 +54,22 @@ before:
|
|||
|
||||
# - comment: # [SQL]: Change tax sign for credit note (must be run before update)
|
||||
# tables: account_tax_template
|
||||
# version: 4.0
|
||||
# query:
|
||||
# UPDATE account_tax_template
|
||||
# SET
|
||||
# credit_note_base_sign = credit_note_base_sign * -1,
|
||||
# credit_note_tax_sign = credit_note_tax_sign * -1;
|
||||
# - tables: account_tax
|
||||
# query:
|
||||
# UPDATE account_tax
|
||||
# SET
|
||||
# credit_note_base_sign = credit_note_base_sign * -1,
|
||||
# credit_note_tax_sign = credit_note_tax_sign * -1;
|
||||
- tables: account_tax
|
||||
version: 4.0
|
||||
query:
|
||||
UPDATE account_tax
|
||||
SET
|
||||
credit_note_base_sign = credit_note_base_sign * -1,
|
||||
credit_note_tax_sign = credit_note_tax_sign * -1;
|
||||
|
||||
- comment: # [SQL]: Fix amount second currency with 3.4 -> 3.6
|
||||
version: 3.6
|
||||
tables: account_move_line
|
||||
query:
|
||||
UPDATE account_move_line
|
||||
|
|
7
upgrade
7
upgrade
|
@ -124,8 +124,7 @@ def process_actions(actions):
|
|||
script = action.get('script')
|
||||
|
||||
# Check version
|
||||
if version != trytond_version:
|
||||
# Unfortunately we can only check for exact version
|
||||
if version <= trytond_version and version >= from_version:
|
||||
continue
|
||||
|
||||
# Check tables
|
||||
|
@ -161,8 +160,9 @@ def process_actions(actions):
|
|||
run('upgrades/after/' + script, database_name, args.config)
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='Upgrade a Tryton database.')
|
||||
parser = argparse.ArgumentParser(description='Upgrade a Tryton database to the version of the trytond library available.')
|
||||
parser.add_argument('database', nargs=1, help='PostgreSQL database to upgrade')
|
||||
parser.add_argument('from_version', nargs=1, help='Tryton version of the database to be migrated')
|
||||
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',
|
||||
|
@ -171,6 +171,7 @@ parser.add_argument('-p', '--purge', action='store_true', dest='purge',
|
|||
args = parser.parse_args()
|
||||
|
||||
database_name, = args.database
|
||||
from_version, = args.from_version
|
||||
config_file = args.config
|
||||
|
||||
url = get_url()
|
||||
|
|
Loading…
Reference in New Issue