Migration de la base esup-portail 2.4 -> 2.5

Ce document décrit la procédure de migration de la base esup-portail d'un package uPortal-2.4-esup vers uPortal-2.5-esup.


Vincent  MATHIEU 
Université Nancy 2

Dates de modification
Revision version 1.0 15/12/2005
1. Préalable
2. Principaux changements de la base
3. Requêtes SQL

1. Préalable

Lire au préalable le document de migration de uPortal-2.4-esup vers uPortal-2.5-esup.

En particulier, Faire une sauvegarde de la base avant toute intervention, et faire ces interventions avec le ou les serveurs portail arrêtés.

2. Principaux changements de la base

Les principaux changements de la base sont les suivants :

La procédure présentée ici s'appuis sur le document jasig suivant.. Elle a été validée sur un serveur mysql 4.1.9 et une base innodb.

Les principales modifications par rapport à ce document concernent :

3. Requêtes SQL

--
-- MySQL UPdate 
--

-- ##################### UPDATE UP_VERSIONS #####################

UPDATE UP_VERSIONS SET MINOR=5, MICRO=0 WHERE FNAME='UP_FRAMEWORK';

-- ##################### DROP TABLES #####################

DROP TABLE UP_RESTRICTIONS;
DROP TABLE UPC_KEYWORD;

-- ##################### UP_LAYOUT_RESTRICTIONS #####################

ALTER TABLE `UP_LAYOUT_RESTRICTIONS` 
   ADD `RESTRICTION_NAME` VARCHAR( 128 ) NOT NULL AFTER `RESTRICTION_TYPE` ;

UPDATE `UP_LAYOUT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'priority' WHERE `RESTRICTION_TYPE` = 1;
UPDATE `UP_LAYOUT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'depth' WHERE `RESTRICTION_TYPE` = 2;
UPDATE `UP_LAYOUT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'immutable' WHERE `RESTRICTION_TYPE` = 6;
UPDATE `UP_LAYOUT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'immutable' WHERE `RESTRICTION_TYPE` = 8;

ALTER TABLE `UP_LAYOUT_RESTRICTIONS` DROP PRIMARY KEY ,
ADD PRIMARY KEY ( `LAYOUT_ID` , `USER_ID` , `NODE_ID` , `RESTRICTION_NAME` , `RESTRICTION_TREE_PATH` );

ALTER TABLE `UP_LAYOUT_RESTRICTIONS` DROP `RESTRICTION_TYPE`;

-- ##################### UP_FRAGMENT_RESTRICTIONS #####################

ALTER TABLE `UP_FRAGMENT_RESTRICTIONS` 
    ADD `RESTRICTION_NAME` VARCHAR( 128 ) NOT NULL AFTER `RESTRICTION_TYPE` ;

UPDATE `UP_FRAGMENT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'priority' WHERE `RESTRICTION_TYPE` = 1;
UPDATE `UP_FRAGMENT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'depth' WHERE `RESTRICTION_TYPE` = 2;
UPDATE `UP_FRAGMENT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'immutable' WHERE `RESTRICTION_TYPE` = 6;
UPDATE `UP_FRAGMENT_RESTRICTIONS` SET `RESTRICTION_NAME` = 'immutable' WHERE `RESTRICTION_TYPE` = 8;

ALTER TABLE `UP_FRAGMENT_RESTRICTIONS` DROP PRIMARY KEY ,
ADD PRIMARY KEY ( `FRAGMENT_ID` , `NODE_ID` , `RESTRICTION_NAME` , `RESTRICTION_TREE_PATH` );

ALTER TABLE `UP_FRAGMENT_RESTRICTIONS` DROP `RESTRICTION_TYPE`;

-- ##################### UP_CHANNEL #####################
UPDATE UP_CHANNEL
	SET CHAN_CLASS='org.jasig.portal.layout.alm.channels.CContentSubscriber'
	WHERE CHAN_CLASS='org.jasig.portal.layout.channels.CContentSubscriber';


-- ##################### UP_CHAN_TYPE #####################
	UPDATE UP_CHAN_TYPE SET TYPE_NAME='XML SSL' WHERE TYPE_ID=1;

	INSERT INTO UP_CHAN_TYPE (TYPE_ID, TYPE_NAME, TYPE, TYPE_DESCR, TYPE_DEF_URI)
	VALUES (
		8, 
		'XML XSLT', 
		'org.jasig.portal.channels.CGenericXSLT', 
		'Transforms an XML document into a fragment of markup language using a single XSLT.',
		'/org/jasig/portal/channels/CGenericXSLT/CGenericJustXSLT.cpd');


-- ##################### UP_SS_STRUCT #####################
	INSERT INTO UP_SS_STRUCT (SS_ID, SS_NAME, SS_URI, SS_DESCRIPTION_URI, SS_DESCRIPTION_TEXT)
	VALUES (
		4, 
		'DLM Tabs and columns', 
		'/org/jasig/portal/layout/DLM-tab-column/tab-column.xsl', 
		'/org/jasig/portal/layout/DLM-tab-column/tab-column.sdf',
		'Presents the DLM layout in terms of tabs and columns.');

-- ##################### UP_SS_THEME #####################
	INSERT INTO UP_SS_THEME (
		SS_ID, SS_NAME, SS_URI, SS_DESCRIPTION_URI, SS_DESCRIPTION_TEXT, STRUCT_SS_ID, SAMPLE_ICON_URI, SAMPLE_URI, MIME_TYPE, DEVICE_TYPE,
		SERIALIZER_NAME, UP_MODULE_CLASS)
	VALUES (
		3, 
		'DLM Nested tables', 
		'/org/jasig/portal/layout/DLM-tab-column/nested-tables/nested-tables.xsl',
		'/org/jasig/portal/layout/DLM-tab-column/nested-tables/nested-tables.sdf', 
		'Renders DLM tabs and columns as nested tables', 
		4,
		'media/org/jasig/portal/layout/DLM-tab-column/nested-tables/sample_icon.gif', 
		'media/org/jasig/portal/layout/DLM-tab-column/nested-tables/sample_full.gif',
		'text/html', 
		'workstation', 
		'HTML', 
		'org.jasig.portal.channels.DLMUserPreferences.TabColumnPrefsState');

-- ##################### UP_SS_THEME_PARM #####################
--   -------------------  adapter eventuellement la valeur du skin en fonction de votre etablissement ----------------------------
	INSERT INTO UP_SS_THEME_PARM (SS_ID, PARAM_NAME, PARAM_DEFAULT_VAL, PARAM_DESCRIPT, TYPE)
	VALUES (3, 'skin', 'esup', 'Design skin name', 1);

	INSERT INTO UP_SS_THEME_PARM (SS_ID, PARAM_NAME, PARAM_DEFAULT_VAL, PARAM_DESCRIPT, TYPE)
	VALUES (3, 'minimized', 'false', 'Flag determining if the channel is minimized or not', 3);

-- ##################### UP_SS_STRUCT_PAR #####################
INSERT INTO UP_SS_STRUCT_PAR (SS_ID, PARAM_NAME, PARAM_DEFAULT_VAL, PARAM_DESCRIPT, TYPE)
	VALUES (4, 'activeTab', '1', 'The number of the DLM tab that is initially active', 1);

	INSERT INTO UP_SS_STRUCT_PAR (SS_ID, PARAM_NAME, PARAM_DEFAULT_VAL, PARAM_DESCRIPT, TYPE)
	VALUES (4, 'width', '100%', 'Width of a DLM column', 2);

-- ##################### UP_SS_MAP #####################
	INSERT INTO UP_SS_MAP (THEME_SS_ID, STRUCT_SS_ID, MIME_TYPE)
	VALUES (3, 4, 'text/html');


		

IMPORTANT : Les commandes suivantes ne doivent retourner aucun enregistrement :

SELECT * FROM `UP_LAYOUT_RESTRICTIONS` WHERE `RESTRICTION_NAME` = '';
SELECT * FROM `UP_FRAGMENT_RESTRICTIONS` WHERE `RESTRICTION_NAME` = '';