* add support for db_schema release column.
* a new command line option '--set-release'
* when .up scripts are applied - the db_schema release column
is set from either --set-release option or /etc/ngcp_version
as the fallback.
* the release column is updated for all applied scripts after
all of them are applied, that is to include revisions that
were applied by the script before the 'release' column.
applied_at timestamp is preserved to keep the original time
when the revision was applied.
* new command line options --get-release-info and --as-json:
when --get-release-info is specified - a table with
"release,min_revision,max_revision,count" is returned and
no scripts processing takes place. With --as-json the data
is returned as a JSON string instead (for possible parsing
automation purposes).
* new command line option --downgrade-release:
- mutually exclusve with --mode
- automatically enables --mode=down
- removes all revisions that match the specified release version
* fix --mode=down --batch-mode, add missing ';' between delete
and commit sql statements.
Change-Id: I529ab523d7886a94848f6d9bbcf4a0348d0842ef
* ngcp-update-db-schema is rewritten in python. that simplifies
the code, as well as enables flexibility and more complex features
support, as well as performance improvements
* full strict mypy compliant
* flake8 compliant
* google docstring complied
* add .down scripts support
* add docstring full documentation
* add mypy, isort, flake8 checks during build phase
* add command line arguments that support --to-revision, to stop
.up/.down scripts execution when it reaches a certain revision
* better support for ngcp-sync-db
* preserve AUTOMATED_INSTALL_MODE and SKIP_SYNC_DB env vars support
for backward compatibility, in the future it is recommented to
switch to the existing (--automated, --skip-ro-sync-db) options
* experimental batch mode support where instead of applying changes
one by one, they are accumulated into a file along with db_schema
revision tracking changes and applied at once
Change-Id: I4632393d52d1a60c945b4d87a779f1a073ed9a5f
The main tool ngcp-build-schema-files:
1. initializes and starts a dedicated mysql instance in tmpfs.
2. prepares schemes.
3. runs ngcp-dump-json.pl and mysqldump to get sql and json files.
4. stops and deletes mysql instance.
The helper ngcp-dump-json.pl creates json dump of the schema.
Change-Id: I65968d0f9136b619f9adc5ed735daca0bd129e6e