From 48e67ba39deb6683593826274aeac02ea2cf6eb9 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Sun, 10 Feb 2008 11:45:14 +0000 Subject: * added renaming functionality that upgrades exports and systems that follow the old naming scheme (single colon) to the current one (double colon) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1530 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/OpenSLX/DBSchema.pm | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'config-db') diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm index 26d85465..b6211c74 100644 --- a/config-db/OpenSLX/DBSchema.pm +++ b/config-db/OpenSLX/DBSchema.pm @@ -35,7 +35,7 @@ use OpenSLX::Basics; ### fk => foreign key (integer) ################################################################################ -my $VERSION = 0.25; +my $VERSION = 0.26; my $DbSchema = { 'version' => $VERSION, @@ -647,6 +647,29 @@ sub _schemaUpgradeDBFrom # drop attribute ramfs_screen $metaDB->removeAttributeByName('ramfs_screen'); + return 1; + }, + 0.26 => sub { + my $metaDB = shift; + + # rename all exports and systems that contain a single colon to + # the current naming scheme with a double colon + foreach my $system ($metaDB->fetchSystemByFilter()) { + if ($system->{name} =~ m{^([^:]+):([^:]+)$}) { + if ($system->{label} eq $system->{name}) { + $system->{label} = "${1}::${2}"; + } + $system->{name} = "${1}::${2}"; + $metaDB->changeSystem([ $system->{id} ], [ $system ]); + } + } + foreach my $export ($metaDB->fetchExportByFilter()) { + if ($export->{name} =~ m{^([^:]+):([^:]+)$}) { + $export->{name} = "${1}::${2}"; + $metaDB->changeExport([ $export->{id} ], [ $export ]); + } + } + return 1; }, ); -- cgit v1.2.3-55-g7522