refactor the ara database schema
this is a major rewrite of the database schema and the ansible callback module (which means that nothing else will work with this commit at the moment). This commit makes the following changes: - We move some default values into a separate ara.defaults module just to keep things tidy. - We always create ~/.ara (or wherever `ARA_DIR` points). This simplifies working with sqlite: if you're using the default database it Just Works, and if you want to put it someplace else it's your job to make sure the destination directory exists. - We make a number of column type changes in the database, so that dates are recorded as datetime types, and booleans are booleans, and we replace db.String with db.Text (because db.String gets converted into a MySQL VARCHAR, which requires a length). - We introduce a new TaskResult entity. This lets us track duration for an entire task vs. the time it takes on each individual host. It also avoids repeating information for host that is global to the task (like the name, action, path, line number, etc). - We isolate all knowledge of primary keys to the ara.models module. - We stop storing "duration" in the database, because this can be calculated. Most of the database entities inherit from a `TimedEntity` mixin that adds the `duration` property which will perform this calculation automatically. - We introduce a 'commit' decorator to avoid lots of boilerplate code. - Database configuration is now always provided as a SQLAlchemy URI. These changes have been tested with both sqlite and mysql.
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
Flask
|
||||
Flask-SQLAlchemy
|
||||
pbr>=1.6
|
||||
pbr>=1.6
|
||||
decorator
|
||||
|
||||
Reference in New Issue
Block a user