zikula-modules / Clip

Flexible Document Creator
35 stars 8 forks source link

Upgrade from PageMaster 0.4.2 #47

Open hvorragend opened 13 years ago

hvorragend commented 13 years ago

How can I upgrade from PageMaster 0.4.2 to the latest Clip version?

After deleting PageMaster in the /modules directory and uploading Clip, I have seen a possible Clip upgrade in the Extensions module.

But the following error occurs if I try an upgrade:

Could not load the 'extensions' module at 'upgrade'.
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db123.clip_pubtypes' doesn't exist. Failing Query: "SELECT c.tid AS c__tid FROM clip_pubtypes c"

First my tables look like this:

Now, after the upgrade error, the tables are called:

hvorragend commented 12 years ago

@rmburkhead : I just tested it again on my development site. The result was:

Older error deleted by herr.vorragend

matheo commented 12 years ago

Ok, an old set of 37 pagemaster_* tables went fine after a long upgrade. Please test to see if the solution is Ok.

gfr commented 12 years ago

When I try to upgrade from PageMaster 0.4.2 i get the following error-message: SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'is_title'. Failing Query: "ALTER TABLE clip_pubfields CHANGE pm_istitle is_title INT DEFAULT NULL NOT NULL"

matheo commented 12 years ago

That looks weird :\ Seems that DoctrineUtil fetch the column options automatically, I just ask for rename the column, but it add the options, and seems that your installation has such setup.

I recommend you to retry after change manually the default values of those pm_is* fields to 0.

hvorragend commented 12 years ago

Upgrade (Database: zikula.org)

My update stopped with:

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.clip_pubtypes' doesn't exist. Failing Query: "DESCRIBE clip_pubtypes"

I have a table called "zk_clip_pubtypes". If I remove the prefix manually, then the update stops with:

Error in DBUtil::executeSQL: UPDATE zk_clip_pubtypes SET pm_sortfield1 = REPLACE(pmsortfield1, 'pm', 'core_'), pm_sortfield2 = REPLACE(pmsortfield2, 'pm', 'core_'), pm_sortfield3 = REPLACE(pmsortfield3, 'pm', 'core_') SQLSTATE[42S02]: Base table or view not found: 1146 Table 'db.zk_clip_pubtypes' doesn't exist

hvorragend commented 12 years ago

More informations.

My database tables BEFORE executing the Clip upgrade:


Error message:

Could not load the 'extensions' module at 'upgrade'.
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.clip_pubtypes' doesn't exist. Failing Query: "DESCRIBE clip_pubtypes"

Exception Trace
#0 Exception thrown in /www/htdocs/host/lib/vendor/Doctrine/Doctrine/Connection.php, line 1082.
#1 /www/htdocs/host/lib/vendor/Doctrine/Doctrine/Connection.php(862): Doctrine_Connection->execute('DESCRIBE clip_p...', Array)
#2 /www/htdocs/host/lib/vendor/Doctrine/Doctrine/Import/Mysql.php(143): Doctrine_Connection->fetchAssoc('DESCRIBE clip_p...')
#3 /www/htdocs/host/lib/util/DoctrineUtil.php(237): Doctrine_Import_Mysql->listTableColumns('clip_pubtypes')
#4 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(489): DoctrineUtil::renameColumn('clip_pubtypes', 'pm_tid', 'tid')
#5 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(96): Clip_Installer::renameClipTables()
#6 [internal function]: Clip_Installer->upgrade('0.4.2')
#7 /www/htdocs/host/system/Extensions/lib/Extensions/Api/Admin.php(1021): call_user_func(Array, '0.4.2')
#8 [internal function]: Extensions_Api_Admin->upgrade(Array)
#9 /www/htdocs/host/lib/util/ModUtil.php(1089): call_user_func(Array, Array)
#10 /www/htdocs/host/lib/util/ModUtil.php(1194): ModUtil::exec('Extensions', 'admin', 'upgrade', Array, true, NULL)
#11 /www/htdocs/host/system/Extensions/lib/Extensions/Controller/Admin.php(722): ModUtil::apiFunc('Extensions', 'admin', 'upgrade', Array)
#12 [internal function]: Extensions_Controller_Admin->upgrade(Array)
#13 /www/htdocs/host/lib/util/ModUtil.php(1089): call_user_func(Array, Array)
#14 /www/htdocs/host/lib/util/ModUtil.php(1168): ModUtil::exec('Extensions', 'admin', 'upgrade', Array, false, NULL)
#15 /www/htdocs/host/index.php(78): ModUtil::func('Extensions', 'admin', 'upgrade', Array)
#16 {main}

Database tables AFTER the broken upgrade:

hvorragend commented 12 years ago

Found while debugging:

We should pay more attention to the fact that there could be a prefix or the prefix was already removed by the core upgrade functions.

The following lines will not work, because the table group_perms has already been renamed by the core.

            case '0.4.15':
                // update the permission schema
                $table = DBUtil::getLimitedTablename('group_perms');
                DBUtil::executeSQL("UPDATE $table SET component = 'Clip:.*?:display' WHERE component = 'Clip:full:'");

Causes the following error:

Error in DBUtil::executeSQL: UPDATE zk_group_perms SET component = 'Clip:.*?:display' WHERE component = 'Clip:full:'
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'database.zk_group_perms' doesn't exist
#0 /www/htdocs/host/lib/vendor/Doctrine/Doctrine/Connection/Statement.php(269): Doctrine_Connection->rethrowException(Object(PDOException), Object(Doctrine_Connection_Statement))
#1 /www/htdocs/host/lib/util/DBUtil.php(279): Doctrine_Connection_Statement->execute()
#2 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(141): DBUtil::executeSQL('UPDATE zk_group...')
#3 [internal function]: Clip_Installer->upgrade('0.4.2')
#4 /www/htdocs/host/system/Extensions/lib/Extensions/Api/Admin.php(1021): call_user_func(Array, '0.4.2')
#5 [internal function]: Extensions_Api_Admin->upgrade(Array)
#6 /www/htdocs/host/lib/util/ModUtil.php(1089): call_user_func(Array, Array)
#7 /www/htdocs/host/lib/util/ModUtil.php(1194): ModUtil::exec('Extensions', 'admin', 'upgrade', Array, true, NULL)
#8 /www/htdocs/host/system/Extensions/lib/Extensions/Controller/Admin.php(722): ModUtil::apiFunc('Extensions', 'admin', 'upgrade', Array)
#9 [internal function]: Extensions_Controller_Admin->upgrade(Array)
#10 /www/htdocs/host/lib/util/ModUtil.php(1089): call_user_func(Array, Array)
#11 /www/htdocs/host/lib/util/ModUtil.php(1168): ModUtil::exec('Extensions', 'admin', 'upgrade', Array, false, NULL)
#12 /www/htdocs/host/index.php(78): ModUtil::func('Extensions', 'admin', 'upgrade', Array)
#13 {main}
hvorragend commented 12 years ago

Another upgrade (Database: blog.zikula.org)

pagemaster 0.2 => PageMaster 0.4.2 (done) => Clip 0.9.2 (error)

SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'is_title'. Failing Query: "ALTER TABLE clip_pubfields CHANGE pm_istitle is_title INT DEFAULT NULL NOT NULL"

Exception Trace
#0 Exception thrown in /www/htdocs/host/lib/vendor/Doctrine/Doctrine/Connection.php, line 1082.
#1 /www/htdocs/host/lib/vendor/Doctrine/Doctrine/Export.php(621): Doctrine_Connection->execute('ALTER TABLE cli...')
#2 /www/htdocs/host/lib/util/DoctrineUtil.php(253): Doctrine_Export->alterTable('clip_pubfields', Array, false)
#3 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(962): DoctrineUtil::renameColumn('clip_pubfields', 'pm_istitle', 'is_title')
#4 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(994): Clip_Installer::upgTablePubfields()
#5 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(682): Clip_Installer->upgradeDBpre09()
#6 /www/htdocs/host/modules/Clip/lib/Clip/Installer.php(105): Clip_Installer->migratePubField()
#7 [internal function]: Clip_Installer->upgrade('0.4.2')
#8 /www/htdocs/host/system/Extensions/lib/Extensions/Api/Admin.php(1021): call_user_func(Array, '0.4.2')
#9 [internal function]: Extensions_Api_Admin->upgrade(Array)
#10 /www/htdocs/host/lib/util/ModUtil.php(1089): call_user_func(Array, Array)
#11 /www/htdocs/host/lib/util/ModUtil.php(1194): ModUtil::exec('Extensions', 'admin', 'upgrade', Array, true, NULL)
#12 /www/htdocs/host/system/Extensions/lib/Extensions/Controller/Admin.php(722): ModUtil::apiFunc('Extensions', 'admin', 'upgrade', Array)
#13 [internal function]: Extensions_Controller_Admin->upgrade(Array)
#14 /www/htdocs/host/lib/util/ModUtil.php(1089): call_user_func(Array, Array)
#15 /www/htdocs/host/lib/util/ModUtil.php(1168): ModUtil::exec('Extensions', 'admin', 'upgrade', Array, false, NULL)
#16 /www/htdocs/host/index.php(78): ModUtil::func('Extensions', 'admin', 'upgrade', Array)
#17 {main}
hvorragend commented 12 years ago

Mateo wrote:

I recommend you to retry after change manually the default values of those pm_is* fields to 0.

First I thought that this doesn't help, but you meant the default values for all fields. That fixes this error and the upgrade continues.

hvorragend commented 12 years ago

I have to change the content of the field plugin (table: clip_pubfields) manually:

Before After
function.String.php String
function.Text.php Text
FRWo commented 11 years ago

I'm just testing the upgrade from pm 0.42 to clip 0.93 and it seems that the handling with old prefixes isn't correct.

My DB-name is "intranet" my prefix is "buka" and somtimes I get the error table "intranet.clip.pubfields" (f.e) could not be found; after manually renaming the table I get the error Table 'intranet.buka_clip_pubfields' doesn't exist.

So it seems, that clip somtimes know about the prefix and other times not.