the first major round of changes for versioning

This commit is contained in:
JT Smith 2005-07-06 22:21:52 +00:00
parent e535c5d43f
commit 5531a9b3d2
10 changed files with 443 additions and 303 deletions

View file

@ -7,7 +7,7 @@ developer then this file won't make a lot of sense.
CONTENTS
1. Wobject Migration
1. Wobject/Asset Migration
2. Macro Migration
3. Authentication Migration
4. Scheduler Migration
@ -15,8 +15,8 @@ CONTENTS
1. Wobject Migration
--------------------
1. Wobject/Asset Migration
--------------------------
1.1 Global Unique Wobject IDs
@ -126,6 +126,40 @@ The following tips should also help make your migration easer:
been replaced by the WebGUI::Asset::Template asset.
1.3 Quick Read Assets
As of 6.7.0 Quick Read Assets have been removed. If you adopted quick read
assets between 6.3.0 and 6.7.0 you'll need to change the getLineage rule from
returnQuickReadObjects to returnObjects.
1.4 Versioning
If you're building any custom assets you'll need to write an upgrade script
for 6.6 to 6.7 that will add a revisionDate (bigint) field to your namespace
table. And you'll need to select the revisionDate from the asset table to
initially populate the field in your table. revisionDate along with assetId
should create a composite primary key for your table. Here are some example
SQL queries to get you started in your transition:
alter table MyAsset add column revisionDate bigint not null;
alter table MyAsset drop primary key;
...look up the revision date for each asset instance from the asset table...
alter table MyAsset add primary key (assetId,revisionDate);
Other than that you shouldn't have to make any revisions to your asset to
support versioning. Your collateral tables need not have the revision date as
they'll be tied to the assetId regardless of the revision date.
1.5 Constructor API Change
In 6.7.0 the new() and newByDynamicClass() API's in WebGUI::Asset changed
slightly. In most situations the changes will not cause any problems, but for
some asset developers there may be a slight change.
2. Macro Migration
-------------------

View file

@ -20,10 +20,10 @@ GetOptions(
WebGUI::Session::open("../..",$configFile);
addAssetVersioning();
insertHelpTemplate();
insertXSLTSheets();
insertSyndicatedContentTemplate();
addAssetVersioning();
WebGUI::Session::close();
@ -38,6 +38,76 @@ sub addAssetVersioning {
commitDate bigint not null default 0,
committedBy varchar(22)
)");
my $now = time();
WebGUI::SQL->write("insert into assetVersionTag values ('pbversion0000000000001','Initial Import','1',$now,'3',$now,'3')");
WebGUI::SQL->write("insert into assetVersionTag values ('pbversion0000000000002','Auto Commit','1',$now,'3',$now,'3')");
foreach my $table (qw(FileAsset Post RichEdit Snippet EventsCalendar_Event ImageAsset Thread redirect Shortcut Template Article EventsCalendar IndexedSearch MessageBoard SQLReport Folder Navigation Survey WSClient Collaboration HttpProxy Layout Poll SyndicatedContent Product DataForm wobject)) {
WebGUI::SQL->write("alter table $table add column revisionDate bigint not null");
WebGUI::SQL->write("update $table set revisionDate=$now");
WebGUI::SQL->write("alter table $table drop primary key");
WebGUI::SQL->write("alter table $table add primary key (assetId,revisionDate)");
}
WebGUI::SQL->write("create table assetData (
assetId varchar(22) not null,
revisionDate bigint,
revisedBy varchar(22) not null,
tagId varchar(22) not null,
status varchar(35) not null default 'pending',
title varchar(255) not null default 'untitled',
menuTitle varchar(255) not null default 'untitled',
url varchar(255) not null,
ownerUserId varchar(22) not null default '3',
groupIdView varchar(22) not null default '7',
groupIdEdit varchar(22) not null default '4',
startDate bigint not null default 997995720,
endDate bigint not null default 32472169200,
synopsis text,
newWindow int not null default 0,
isHidden int not null default 0,
isPackage int not null default 0,
isPrototype int not null default 0,
encryptPage int not null default 0,
assetSize int not null default 0,
extraHeadTags text,
primary key (assetId,revisionDate)
)");
my $statement = WebGUI::SQL->prepare("insert into assetData values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
my $sth = WebGUI::SQL->read("select * from asset");
while (my $data = $sth->hashRef) {
$statement->execute([
$data->{assetId},
$now,
'3',
'pbversion0000000000001',
'approved',
$data->{title},
$data->{menuTitle},
$data->{url},
$data->{ownerUserId},
$data->{groupIdView},
$data->{groupIdEdit},
$data->{startDate},
$data->{endDate},
$data->{synopsis},
$data->{newWindow},
$data->{isHidden},
$data->{isPackage},
$data->{isPrototype},
$data->{encryptPage},
$data->{assetSize},
$data->{extraHeadTags}
]);
}
$sth->finish;
WebGUI::SQL->write("alter table asset add column creationDate bigint not null default 997995720");
WebGUI::SQL->write("alter table asset add column createdBy varchar(22) not null default '3'");
WebGUI::SQL->write("alter table asset add column stateChangedBy varchar(22) not null default '3'");
WebGUI::SQL->write("alter table asset add column isLockedBy varchar(22)");
WebGUI::SQL->write("update asset set creationDate=$now, createdBy='3'");
foreach my $field (qw(url groupIdView title menuTitle startDate endDate ownerUserId groupIdEdit synopsis newWindow isHidden isSystem encryptPage assetSize lastUpdated lastUpdatedBy isPackage extraHeadTags isPrototype)) {
WebGUI::SQL->write("alter table asset drop column $field");
}
}