From 9bdcb088ebddb422cd8e9a27e688e9718cf50013 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Mon, 2 Jun 2008 22:30:19 +0000 Subject: Implemented a better algorithm for keeping the plugins and the references to them (and their attributes) in the DB in sync: * The DB now keeps a hash-value for the list of known plugins and their attributes and checks this value against the current one on every connect. If the values do not match, the DB is brought up-to-date automatically (i.e. the attributes are synchronized with the systems, clients and groups). git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@1837 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/OpenSLX/DBSchema.pm | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'config-db/OpenSLX/DBSchema.pm') diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index 3fa9c40b..24f46fc6 100644 --- a/config-db/OpenSLX/DBSchema.pm +++ b/config-db/OpenSLX/DBSchema.pm @@ -34,7 +34,7 @@ use OpenSLX::Basics; ### fk => foreign key (integer) ################################################################################ -my $VERSION = 0.32; +my $VERSION = 0.33; my $DbSchema = { 'version' => $VERSION, @@ -173,11 +173,16 @@ my $DbSchema = { 'meta' => { # information about the database as such 'cols' => [ - 'schema_version:s.5', # schema-version currently implemented by DB + 'plugin_info_hash:s.32', # hash-value identifying a specific + # set of plugins and their + # attributes + 'schema_version:s.5', # schema-version currently + # implemented by DB ], 'vals' => [ { - 'schema_version' => $VERSION, + 'plugin_info_hash' => '', + 'schema_version' => $VERSION, }, ], }, @@ -721,6 +726,24 @@ sub _schemaUpgradeDBFrom # dummy schema change, just to trigger the attribute synchronization, # as the 'theme' plugin has been removed + return 1; + }, + 0.33 => sub { + my $metaDB = shift; + + # add new column meta.plugin_info_hash + $metaDB->schemaAddColumns( + 'meta', + [ + 'plugin_info_hash:s.32', + ], + undef, + [ + 'plugin_info_hash:s.32', + 'schema_version:s.5', + ] + ); + return 1; }, ); -- cgit v1.2.3-55-g7522