Update DB-Tabellen von Rex 3.2 zu 4.3.2 -> SQL-Lösung gesuch

Probleme beim Installieren. Servereinstellungen etc.

Update DB-Tabellen von Rex 3.2 zu 4.3.2 -> SQL-Lösung gesuch

Beitragvon Koala » 15. Dez 2011, 22:31

Hat hier jemand zufällig eine funktionierende rein auf SQL-Abfragen basierende Lösung eines Updates der DB Grundtabellen von Redaxo 3.2 auf Redaxo 4.3.2 (inkl. installierten Basis-Addons)?
Auf der Basis, dass so viele Daten wie möglich mit rübergenommen werden.

Bei allem was ich bisher fand, gingen immer irgendwelche Teile verloren und das ist murks.
z.B. die Actions fehlten mir immer - oder ich hab was übersehen ...
.
<?php print $Footer; ?>

Sven

Ich würde ja die Welt verändern,
doch der Quellcode ist mir zu absurd!


REX_DOKU :: REX_WIKI :: REX_FAQ :: REX_WIKIPEDIA
Benutzeravatar
Koala
 
Beiträge: 1529
Registriert: 3. Okt 2005, 12:20
Wohnort: Cottbus

Re: Update DB-Tabellen von Rex 3.2 zu 4.3.2 -> SQL-Lösung ge

Beitragvon Koala » 19. Dez 2011, 23:49

Da ich hier bisher keine Antwort auf meine Frage bekam, hab ich da mal selbst was zusammengestrickt.
ACHTUNG!
Das ganze hat Betastatus! Wer Fehler findet oder Änderungsvorschläge hat, bitte direkt an mich schicken oder eben hierdrauf antworten.

Code: Alles auswählen
-- Update von Redaxo 3.2 zu Redaxo 4.3.2

ALTER TABLE `rex_action` ADD `preview` TEXT, ADD `presave` TEXT, ADD `postsave` TEXT, ADD `previewmode` TINYINT NULL, ADD `presavemode` TINYINT NULL, ADD `postsavemode` TINYINT NULL;
-- weise die Aktionen den neuen Spalten richtig zu
UPDATE `rex_action` SET `presave` = `action` WHERE `prepost` = '0';
UPDATE `rex_action` SET `postsave` = `action` WHERE `prepost` = '1';
UPDATE `rex_action` SET `presavemode` = `sadd` + 2 * `sedit` + 4 * `sdelete` WHERE `prepost` = '0';
UPDATE `rex_action` SET `postsavemode` = `sadd` + 2 * `sedit` + 4 * `sdelete` WHERE `prepost` = '1';
ALTER TABLE `rex_action` DROP `action`, DROP `prepost`, DROP `sadd`, DROP `sedit`, DROP `sdelete`;
ALTER TABLE `rex_action` ADD `createuser` VARCHAR(255) NOT NULL, ADD `createdate` INT(11) NOT NULL, ADD `updateuser` VARCHAR(255) NOT NULL, ADD `updatedate` INT(11) NOT NULL;
ALTER TABLE `rex_action` ADD `revision` INT(11) NOT NULL DEFAULT '0';

ALTER TABLE `rex_article` DROP `cattype`;
ALTER TABLE `rex_article` DROP `alias`;
ALTER TABLE `rex_article` DROP `fe_user`;
ALTER TABLE `rex_article` DROP `fe_group`;
ALTER TABLE `rex_article` DROP `fe_ext`;
ALTER TABLE `rex_article` ADD `revision` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `rex_article` ADD `art_online_from` TEXT NULL;
ALTER TABLE `rex_article` ADD `art_online_to` TEXT NULL;
ALTER TABLE `rex_article` ADD `art_description` TEXT NULL;
ALTER TABLE `rex_article` ADD `art_keywords` TEXT NULL;
ALTER TABLE `rex_article` ADD `art_file` VARCHAR(255) NULL;
ALTER TABLE `rex_article` ADD `art_teaser` VARCHAR(255) NULL;
ALTER TABLE `rex_article` ADD `art_type_id` VARCHAR(255) NULL;
-- hole Inhalte in neue Spalten vor dem Löschen der bisherigen Spalten
UPDATE `rex_article` SET `art_description` = `description`;
UPDATE `rex_article` SET `art_keywords` = `keywords`;
UPDATE `rex_article` SET `art_file` = `file`;
UPDATE `rex_article` SET `art_teaser` = '|true|' WHERE `teaser` = '1';
UPDATE `rex_article` SET `art_type_id` = 'Standard' WHERE `type_id` = '1';
UPDATE `rex_article` SET `art_online_from` = `online_from`;
UPDATE `rex_article` SET `art_online_to` = `online_to`;
ALTER TABLE `rex_article` DROP `online_from`;
ALTER TABLE `rex_article` DROP `online_to`;
ALTER TABLE `rex_article` DROP `type_id`;
ALTER TABLE `rex_article` DROP `teaser`;
ALTER TABLE `rex_article` DROP `description`;
ALTER TABLE `rex_article` DROP `keywords`;
ALTER TABLE `rex_article` DROP `file`;
ALTER TABLE `rex_article` CHANGE `attribute` `attributes` TEXT NOT NULL;

ALTER TABLE `rex_article_slice` CHANGE `value1` `value1` text NULL, CHANGE `value2` `value2` text NULL, CHANGE `value3` `value3` text NULL, CHANGE `value4` `value4` text NULL, CHANGE `value5` `value5` text NULL, CHANGE `value6` `value6` text NULL, CHANGE `value7` `value7` text NULL, CHANGE `value8` `value8` text NULL, CHANGE `value9` `value9` text NULL, CHANGE `value10` `value10` text NULL, CHANGE `value11` `value11` text NULL, CHANGE `value12` `value12` text NULL, CHANGE `value13` `value13` text NULL, CHANGE `value14` `value14` text NULL, CHANGE `value15` `value15` text NULL, CHANGE `value16` `value16` text NULL, CHANGE `value17` `value17` text NULL, CHANGE `value18` `value18` text NULL, CHANGE `value19` `value19` text NULL, CHANGE `value20` `value20` text NULL, CHANGE `file1` `file1` varchar(255) NULL, CHANGE `file2` `file2` varchar(255) NULL, CHANGE `file3` `file3` varchar(255) NULL, CHANGE `file4` `file4` varchar(255) NULL, CHANGE `file5` `file5` varchar(255) NULL, CHANGE `file6` `file6` varchar(255) NULL, CHANGE `file7` `file7` varchar(255) NULL, CHANGE `file8` `file8` varchar(255) NULL, CHANGE `file9` `file9` varchar(255) NULL, CHANGE `file10` `file10` varchar(255) NULL, CHANGE `filelist1` `filelist1` text NULL, CHANGE `filelist2` `filelist2` text NULL, CHANGE `filelist3` `filelist3` text NULL, CHANGE `filelist4` `filelist4` text NULL, CHANGE `filelist5` `filelist5` text NULL, CHANGE `filelist6` `filelist6` text NULL, CHANGE `filelist7` `filelist7` text NULL, CHANGE `filelist8` `filelist8` text NULL, CHANGE `filelist9` `filelist9` text NULL, CHANGE `filelist10` `filelist10` text NULL, CHANGE `link1` `link1` varchar(10) NULL, CHANGE `link2` `link2` varchar(10) NULL, CHANGE `link3` `link3` varchar(10) NULL, CHANGE `link4` `link4` varchar(10) NULL, CHANGE `link5` `link5` varchar(10) NULL, CHANGE `link6` `link6` varchar(10) NULL, CHANGE `link7` `link7` varchar(10) NULL, CHANGE `link8` `link8` varchar(10) NULL, CHANGE `link9` `link9` varchar(10) NULL, CHANGE `link10` `link10` varchar(10) NULL, CHANGE `linklist1` `linklist1` text NULL, CHANGE `linklist2` `linklist2` text NULL, CHANGE `linklist3` `linklist3` text NULL, CHANGE `linklist4` `linklist4` text NULL, CHANGE `linklist5` `linklist5` text NULL, CHANGE `linklist6` `linklist6` text NULL, CHANGE `linklist7` `linklist7` text NULL, CHANGE `linklist8` `linklist8` text NULL, CHANGE `linklist9` `linklist9` text NULL, CHANGE `linklist10` `linklist10` text NULL, CHANGE `php` `php` text NULL, CHANGE `html` `html` text NULL;
ALTER TABLE `rex_article_slice` CHANGE `clang` `clang` INT(11) NOT NULL, CHANGE `ctype` `ctype` INT(11) NOT NULL, CHANGE `re_article_slice_id` `re_article_slice_id` INT(11) NOT NULL, CHANGE `article_id` `article_id` INT(11) NOT NULL, CHANGE `createdate` `createdate` INT(11) NOT NULL, CHANGE `updatedate` `updatedate` INT(11) NOT NULL;
ALTER TABLE `rex_article_slice` ADD `next_article_slice_id` int(11);
UPDATE `rex_article_slice` SET `ctype`=`ctype`+1;
ALTER TABLE `rex_article_slice` ADD `revision` INT(11) NOT NULL DEFAULT '0';

ALTER TABLE `rex_clang` ADD `revision` INT(11) NOT NULL DEFAULT '0';

ALTER TABLE `rex_file` ADD `attributes` TEXT NULL AFTER `category_id`;
ALTER TABLE `rex_file` ADD `revision` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `rex_file` ADD `med_description` TEXT NULL;
ALTER TABLE `rex_file` ADD `med_copyright` TEXT NULL;
-- hole Inhalte in neue Spalten vor dem Löschen der bisherigen Spalten
UPDATE `rex_file` SET `med_description` = `description`;
UPDATE `rex_file` SET `med_copyright` = `copyright`;
ALTER TABLE `rex_file` DROP `copyright`;
ALTER TABLE `rex_file` DROP `description`;
ALTER TABLE `rex_file` CHANGE `filetype` `filetype` VARCHAR(255) NULL, CHANGE `filename` `filename` VARCHAR(255) NULL, CHANGE `originalname` `originalname` VARCHAR(255) NULL, CHANGE `filesize` `filesize` VARCHAR(255) NULL, CHANGE `title` `title` VARCHAR(255) NULL, CHANGE `width` `width` INT(11) NULL, CHANGE `height` `height` INT(11) NULL;

ALTER TABLE `rex_file_category` DROP `hide`;
ALTER TABLE `rex_file_category` ADD `attributes` TEXT NULL;
ALTER TABLE `rex_file_category` ADD `revision` INT( 11 ) NOT NULL DEFAULT '0';

ALTER TABLE `rex_modultyp` DROP `bausgabe`;
ALTER TABLE `rex_modultyp` DROP `func`;
ALTER TABLE `rex_modultyp` DROP `php_enable`;
ALTER TABLE `rex_modultyp` DROP `html_enable`;
ALTER TABLE `rex_modultyp` DROP `perm_category`;
ALTER TABLE `rex_modultyp` DROP `label`;
ALTER TABLE `rex_modultyp` ADD `attributes` TEXT NULL;
ALTER TABLE `rex_modultyp` ADD `revision` INT( 11 ) NOT NULL DEFAULT '0';
RENAME TABLE `rex_modultyp` TO `rex_module`;

ALTER TABLE `rex_module_action` ADD `revision` INT( 11 ) NOT NULL DEFAULT '0';

ALTER TABLE `rex_template` DROP `bcontent`;
ALTER TABLE `rex_template` DROP `date`;
ALTER TABLE `rex_template` ADD `attributes` TEXT NULL;
ALTER TABLE `rex_template` ADD `revision` INT( 11 ) NOT NULL DEFAULT '0';
ALTER TABLE `rex_template` CHANGE `label` `label` VARCHAR(255) NULL, CHANGE `name` `name` VARCHAR(255) NULL, CHANGE `content` `content` TEXT NULL, CHANGE `active` `active` TINYINT(1) NULL;

-- Da im normalen Redaxoexport keine User-Tabelle dabei ist, ist der Bereich kommentiert
-- ALTER TABLE `rex_user` ADD `cookiekey` varchar(255);
-- ALTER TABLE `rex_user` ADD `revision` INT(11) NOT NULL DEFAULT '0';
-- UPDATE `rex_user` SET `status`=1;


DROP TABLE `rex_article_type`;


-- ###################################################
-- INDEXe
-- Da im normalen Redaxoexport keine User-Tabelle dabei ist, ist der entsprechende Bereich kommentiert
-- ###################################################

ALTER TABLE rex_article ADD INDEX `id` (`id`), ADD INDEX `clang` (`clang`), ADD UNIQUE INDEX `find_articles` (`id`, `clang`), ADD INDEX `re_id` (`re_id`);
ALTER TABLE rex_article_slice ADD INDEX `id` (`id`), ADD INDEX `clang` (`clang`), ADD INDEX `re_article_slice_id` (`re_article_slice_id`), ADD INDEX `article_id` (`article_id`), ADD INDEX `find_slices` (`clang`, `article_id`);
ALTER TABLE rex_file ADD INDEX `re_file_id` (`re_file_id`), ADD INDEX `category_id` (`category_id`);
ALTER TABLE rex_file_category DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD INDEX `re_id` (`re_id`);
ALTER TABLE rex_module DROP PRIMARY KEY, ADD PRIMARY KEY (`id`), ADD INDEX `category_id` (`category_id`);
-- ALTER TABLE rex_user ADD UNIQUE INDEX `login` (`login`(50));



Besonderheiten
Die Keywords und Descriptions der Artikel werden mit übernommen.
Die Actions werden neu zugewiesen (Danke Gregor für die Kurzform :) )


Vorgehen (Erklärungsschnellversion/Megaungenau)
Grundsätzlich gibt es mehrere Wege.
1. Backup der zu ändernden DB anlegen!
2. Backup anlegen!
3. Backup anlegen!

Man kann die bestehende DB nehmen oder sich einen Export schnappen und diesen bearbeiten.
Ich habe das mal lokal mit einem Export und in phpMyAdmin getestet.
Also, nimm einen Export von Redaxo 3.2 welcher mit dem Import-/Exportaddon erstellt wurde.
Ändere die Daten zu utf-8 (öffnen und dann speichern als utf-8 in $Editor deiner Wahl).
Packe alles in eine DB.
Lass das obige SQL drübergehen und wenn keine Fehlermeldung kommt, sollte es das gewesen sein.
Dann können die Tabellen in die eigentliche Rex 4.3.2 Datenbank übernommen werden.


Testumgebung
MySQL Server Version: 5.1.49-3-log
phpMyAdmin 3.1.4

Alles OHNE Garantie!
Zuletzt geändert von Koala am 20. Dez 2011, 23:16, insgesamt 1-mal geändert.
.
<?php print $Footer; ?>

Sven

Ich würde ja die Welt verändern,
doch der Quellcode ist mir zu absurd!


REX_DOKU :: REX_WIKI :: REX_FAQ :: REX_WIKIPEDIA
Benutzeravatar
Koala
 
Beiträge: 1529
Registriert: 3. Okt 2005, 12:20
Wohnort: Cottbus

Re: Update DB-Tabellen von Rex 3.2 zu 4.3.2 -> SQL-Lösung ge

Beitragvon jeandeluxe » 20. Dez 2011, 01:49

Koala hat geschrieben:Da ich hier bisher keine Antwort auf meine Frage bekam,..


Ich hab irgendwann mal ne Liste mit den SQL statements gepostet.. ;)

lg,
j.
mark your solved threads [SOLVED]™ promotion tour.. | Redaxo API Docu | rexdev.de | "You start with some money.."
IT'S A MARATHON. NOT A SPRINT. UNLESS IT IS A SPRINT, THEN SPRINT!
Benutzeravatar
jeandeluxe
 
Beiträge: 1941
Registriert: 29. Sep 2005, 09:50
Wohnort: Hamburg

Re: Update DB-Tabellen von Rex 3.2 zu 4.3.2 -> SQL-Lösung ge

Beitragvon Koala » 20. Dez 2011, 20:15

jeandeluxe hat geschrieben:Ich hab irgendwann mal ne Liste mit den SQL statements gepostet.. ;)

Die hab ich gefunden, aber das betraf mehr den Rex 3.2 Nachfolger. Daher passte das nur annähernd.
.
<?php print $Footer; ?>

Sven

Ich würde ja die Welt verändern,
doch der Quellcode ist mir zu absurd!


REX_DOKU :: REX_WIKI :: REX_FAQ :: REX_WIKIPEDIA
Benutzeravatar
Koala
 
Beiträge: 1529
Registriert: 3. Okt 2005, 12:20
Wohnort: Cottbus

Re: Update DB-Tabellen von Rex 3.2 zu 4.3.2 -> SQL-Lösung ge

Beitragvon jeandeluxe » 20. Dez 2011, 21:40

Koala hat geschrieben:..aber das betraf mehr den Rex 3.2 Nachfolger.


ähh.. nö ;) war schon ab 3.x aufwärts..

lg,
Jan
mark your solved threads [SOLVED]™ promotion tour.. | Redaxo API Docu | rexdev.de | "You start with some money.."
IT'S A MARATHON. NOT A SPRINT. UNLESS IT IS A SPRINT, THEN SPRINT!
Benutzeravatar
jeandeluxe
 
Beiträge: 1941
Registriert: 29. Sep 2005, 09:50
Wohnort: Hamburg


Zurück zu Installation [R4]

Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 2 Gäste

cron