add a sample script for migrating from old inventory

0.6.0-stable
Sean Dague 2008-04-09 00:04:27 +00:00
parent 960d57090f
commit 034255ac24
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
#!/usr/bin/perl
# -- CREATE TABLE inventoryitems(UUID varchar(255) primary key,
# -- assetID varchar(255),
# -- assetType integer,
# -- invType integer,
# -- parentFolderID varchar(255),
# -- avatarID varchar(255),
# -- creatorsID varchar(255),
# -- inventoryName varchar(255),
# -- inventoryDescription varchar(255),
# -- inventoryNextPermissions integer,
# -- inventoryCurrentPermissions integer,
# -- inventoryBasePermissions integer,
# -- inventoryEveryOnePermissions integer);
# -- CREATE TABLE inventoryfolders(UUID varchar(255) primary key,
# -- name varchar(255),
# -- agentID varchar(255),
# -- parentID varchar(255),
# -- type integer,
# -- version integer);
my $items = "INSERT INTO InventoryItems(ID, AssetID, AssetType, InvType, Folder, Owner, Creator, Name, Description, NextPermissions, CurrentPermissions, BasePermissions, EveryOnePermissions) ";
my $folders = "INSERT INTO InventoryFolders(ID, Name, Owner, ParentID, Type, Version) ";
open(SQLITE, "sqlite3 inventoryStore.db .dump |") or die "can't open the database for migration";
while(my $line = <SQLITE>) {
$line =~ s/([0-9a-f]{8})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{4})([0-9a-f]{12})/$1-$2-$3-$4-$5/g;
if($line =~ s/(INSERT INTO "inventoryitems")/$items/) {
print $line;
}
if($line =~ s/(INSERT INTO "inventoryfolders")/$folders/) {
print $line;
}
}