Reduce time complexity of deploy sql file loop
Ahjo deploy action was slow in certain scenarios. This was due the fact that the sql_file_loop function had a time complexity of O(n^2) where n is the number of files to be deployed (since max_loop was set to n when calling the function). Usually this was not a problem, but when files were dependent on each other (e.g. a view is created in one file and used in another) or errors occured during deployment, the function loops through the files multiple times. This has caused the deploy action to freeze for very long periods of time in some cases (so long that the user thinks the action has failed and cancels it).
The time complexity was reduced to O(n) by parsing the SQL files to find dependencies between them and deploying them in topological order.
New master actions for deploying database roles and permissions
Added new master actions for creating database roles, granting database permissions and creating database users. The actions are `create-db-roles`, `grant-db-permissions`, `create-db-users` and `add-users-to-roles`. See the action descriptions for more information.
New master action for visualizing database object dependencies
Added new master action `plot-dependencies` for visualizing sql file dependencies. The action parses the SQL files in the project and creates a dependency graph of the database objects. The graph is plotted with plotly. Currently the action is not supported in MSI-installed Ahjo.
Enable having default metadata information for a column with a certain name
Added the possibility to define default metadata for columns. When updating database object properties, if a table/view has a column with a certain name, and a default value for the metadata for that column has been defined in `./docs/db_objects/columns_default.json`, that value is used, unless there is a row for that specific table's column in `./docs/db_objects/columns.json`.
New flag for `ahjo-scan` command to add found scan results to ignore file
Added a new flag `--add-results-to-ignore` to `ahjo-scan` command. The flag can be used to add all found scan results to the ignore file. If the found scan results already exist in the ignore file, they are not added again.
Add support for passing custom command-line flags to actions
Added a new method `get_cli_arg` to `Context` class. The method can be used to access custom command-line arguments and their values in actions.
For example, to pass a custom boolean flag `--example-flag` to action `example-action`, use the following command:
bash
ahjo example-action <config> --example-flag
In the action, the values of the custom argument can be accessed from the context object:
python
example_flag = context.get_cli_arg("example-flag") Returns True if the flag is passed
Fine adjustments for printing test results
Fine-tuned the printing of database test results to console. Removed unnecessary information from the printed results and added a new line which summarizes how many tests passed.
Improve error handling in ahjo-upgrade
Improved and simplified the `ahjo-upgrade` operation by using a dependency graph to determine the order versions to be deployed. This change also fixed a bug where an incorrect error message was raised when some versions were missing in upgrade_actions file.
Show server & db name in ahjo-upgrade confirmation message
Now the confirmation message in `ahjo-upgrade` shows the target server and database name.
Updated version requirements
- Removed Python 3.11 support
- Added support for cx-freeze 7.2 and azure-identity 1.18.0
- Added new dependencies: networkx, plotly
Improvements to pipelines, tests and MSI build
- Optimized release pipeline
- Updated ODBC Driver 17 to 18 in pytests
- Fixed an incorrect MSI name in UAC prompt