Commit Graph

5 Commits

Author SHA1 Message Date
Leo Hemsted
049514d4b2 remove history-meta for templates, replace with hand-made history table
history-meta's dynamic magic is insufficient for templates, where we
need to be able to refer to the specific history table to take
advantage of sqlalchemy's relationship management (2/3rds of an ORM).
So replace it with a custom made version table.

Had to change the version decorator slightly for this
2016-08-09 16:56:43 +01:00
Rebecca Law
885abcaf16 Make update notification status transcational.
Refactor methods for reusability.
2016-05-27 12:09:36 +01:00
Adam Shimali
d14be2067c When using the versioned decorator I noticed that when adding or
revoking an api key the service it associated with was of course added
to db.session.dirty.

That resulted in an updated version of service being added to the
service history table that showed no visible difference from that
record immediately precending it as the change was to another table,
namely the api_key table. A new api key or revoked api key was correctly
added to api_key and api_key_history tables. However I think an
'unchanged' service history record may be a bit confusing as you'd need
to correlate with api_keys to work out what the change was.

I think it's best to just record the new/revoked api_key and not create
another version of the service.

This pr wraps the exisiting versioned decorator with one that take a
class which you are interested in versioning.

Using the new decorator you only get a new version and history record
for the class you pass to outer decorator.

If the exising behaviour is acceptable to the powers that be then by all
means ignore/close this pr.
2016-04-21 18:10:57 +01:00
Adam Shimali
74ac5b5f30 Added version history to api keys. This needed a bit of change
to create history to handle foreign keys better. There may yet
be a better way of doing this that I have not found yet in sqlalchemy
docs.
2016-04-21 14:47:58 +01:00
Adam Shimali
a6a18c1a6f This approach uses part of sqlalchemy example history_meta code
adapted to recording inserts and updates.

This removes need to manually create history tables.

Our code still remains in control of when history records are
created.
2016-04-19 17:13:26 +01:00