Problems with Neos.Media Migration


(Thomas Grabietz) #1

I had to upgrade an NEOS installation from NEOS 2-x to 3. All dependencies are resolved now and the ./flow command gives me a:

Neos 3.0.15 ("Development" context)

Now I would like to migrate the database but:

./flow doctrine:migrate

returns a

Notice: Undefined index: maximumwidth in /home/www/hosts/wb-web.de/www/htdocs_upgraded/wbweb/Packages/Application/Neos.Media/Migrations/Mysql/Version20150913173832.php line 25

the corresponding code looks like:

 $thumbnailResult = $this->connection->executeQuery('SELECT * FROM typo3_media_domain_model_thumbnail');
        while ($thumbnailInfo = $thumbnailResult->fetch(\PDO::FETCH_ASSOC)) {
            $configurationArray = array_filter([
                'maximumWidth' => $thumbnailInfo['maximumwidth'],
                'maximumHeight' => $thumbnailInfo['maximumheight'],
                'ratioMode' => $thumbnailInfo['ratiomode'],
                'allowUpScaling' => $thumbnailInfo['allowupscaling'] === 1 ? true : false
            ], function ($value) {
                return $value !== null;
            });
            ksort($configurationArray);
            $configuration = json_encode($configurationArray, JSON_PRETTY_PRINT | JSON_FORCE_OBJECT | JSON_UNESCAPED_UNICODE);
            $configurationHash = md5(json_encode($configurationArray));
            $this->addSql(sprintf("UPDATE typo3_media_domain_model_thumbnail SET configuration = '%s', configurationhash = '%s' WHERE persistence_object_identifier = '%s'", $configuration, $configurationHash, $thumbnailInfo['persistence_object_identifier']));
        }

you can find the verbose output of doctrine:migrationstatus here:

https://pastebin.com/Z5zKja8n

any ideas?

Thanks in advance

Tom


(Soren Malling) #2

Just for clarification: It’s a “NOTICE” which is (roughly translated) a “hey, be aware of something but we keep going”. So it seems like your originally created thumbnails was missing a value for a maximumWidth, but it’s not a blocker (IMO).

Did you get any exception that blocked the database migration as a result of the ./flow doctrine:migrate call?


(Thomas Grabietz) #3

yes, you are right. There is no further exception. But you can see in the

doctrine:migrationstatus

https://pastebin.com/Z5zKja8n

that the migration has stopped exactly with this version id (Version20150913173832)

When I try to run the site, the following exception occurs:

SQLSTATE[42S02]: Base table or view not found: 1146 Table ‘neos_neos_domain_model_domain’ doesn’t exist

And in fact: the domain_model_domain has still the old typo3 NS


(Soren Malling) #4

Can you try and run that single migration?

./flow doctrine:migrate --direction up --version 20150913173832

To see if it can be completed somehow


(Thomas Grabietz) #5

That’s what I’ve figured out so far:

./flow doctrine:migrate --direction up --version 20150913173832

throw an exception:

Exception #1 in line 25 of /home/www/hosts/wb-web.de/www/htdocs_upgraded/wbweb/Packages/Application/Neos.Media/Migrations/Mysql/Version20150913173832.php: Notice: Undefined index: maximumwidth in /home/www/hosts/wb-web.de/www/htdocs_upgraded/wbweb/Packages/Application/Neos.Media/Migrations/Mysql/Version20150913173832.php line 25

27 Neos\Flow\Error\ErrorHandler::handleError(8, "Undefined index: maximumwidth", "/home/www/hosts/wb-web.de/www/htdocs_upgraded/wbwe…s.Media/Migrations/Mysql/Version20150913173832.php", 25, array|3|)
26 Neos\Flow\Persistence\Doctrine\Migrations\Version20150913173832::up(ProxyManagerGeneratedProxy\__PM__\Doctrine\DBAL\Schema\Schema\Generatedaca9b50393335f8354881e485c485329)
25 Doctrine\DBAL\Migrations\Version::execute("up", FALSE, FALSE)
24 Doctrine\DBAL\Migrations\Migration::migrate("20150913173832", FALSE)
23 Neos\Flow\Persistence\Doctrine\Service_Original::executeMigrations("20150913173832", NULL, FALSE, FALSE)
22 call_user_func_array(array|2|, array|4|)
21 Neos\Flow\ObjectManagement\DependencyInjection\DependencyProxy::__call("executeMigrations", array|4|)
20 Neos\Flow\Command\DoctrineCommandController_Original::migrateCommand("20150913173832", NULL, FALSE, FALSE)
19 call_user_func_array(array|2|, array|4|)
18 Neos\Flow\Cli\CommandController_Original::callCommandMethod()
17 Neos\Flow\Cli\CommandController_Original::processRequest(Neos\Flow\Cli\Request, Neos\Flow\Cli\Response)
16 Neos\Flow\Mvc\Dispatcher_Original::initiateDispatchLoop(Neos\Flow\Cli\Request, Neos\Flow\Cli\Response)
15 Neos\Flow\Mvc\Dispatcher_Original::dispatch(Neos\Flow\Cli\Request, Neos\Flow\Cli\Response)
14 Neos\Flow\Cli\CommandRequestHandler::Neos\Flow\Cli\{closure}()
13 Closure::__invoke()
12 Neos\Flow\Security\Context_Original::withoutAuthorizationChecks(Closure)
11 Neos\Flow\Security\Context::withoutAuthorizationChecks(Closure)
10 call_user_func_array(array|2|, array|1|)
9 Neos\Flow\Security\Context::Flow_Aop_Proxy_invokeJoinPoint(Neos\Flow\Aop\JoinPoint)
8 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
7 Neos\Flow\Session\Aspect\LazyLoadingAspect_Original::callMethodOnOriginalSessionObject(Neos\Flow\Aop\JoinPoint)
6 Neos\Flow\Aop\Advice\AroundAdvice::invoke(Neos\Flow\Aop\JoinPoint)
5 Neos\Flow\Aop\Advice\AdviceChain::proceed(Neos\Flow\Aop\JoinPoint)
4 Neos\Flow\Security\Context::withoutAuthorizationChecks(Closure)
3 Neos\Flow\Cli\CommandRequestHandler::handleRequest()
2 Neos\Flow\Core\Bootstrap::run()
1 require("/home/www/hosts/wb-web.de/www/htdocs_upgraded/wbweb/Packages/Framework/Neos.Flow/Scripts/flow.php")

The current state of the thumbnail columns is:

show columns from typo3_media_domain_model_thumbnail


+-------------------------------+-------------+------+-----+---------+-------+
| Field                         | Type        | Null | Key | Default | Extra |
+-------------------------------+-------------+------+-----+---------+-------+
| persistence_object_identifier | varchar(40) | NO   | PRI | NULL    |       |
| originalasset                 | varchar(40) | NO   | MUL | NULL    |       |
| resource                      | varchar(40) | NO   | UNI | NULL    |       |
| width                         | int(11)     | YES  |     | NULL    |       |
| height                        | int(11)     | YES  |     | NULL    |       |
| configuration                 | longtext    | NO   |     | NULL    |       |
| configurationhash             | varchar(32) | NO   |     | NULL    |       |
+-------------------------------+-------------+------+-----+---------+-------+

Version20141118172322.php is the script, which alters the table

but it seems to me that this script is/was never exececuted:

 ./flow doctrine:migrationstatus   --show-migrations  | grep Neos.Media
    > 2011-09-25 12:31:20 (20110925123120) Neos.Media                      migrated
    > 2012-03-29 22:03:44 (20120329220344) Neos.Media                      migrated
    > 2012-10-01 18:11:37 (20121001181137) Neos.Media                      migrated
    > 2012-10-11 14:09:46 (20121011140946) Neos.Media                      migrated
    > 2013-05-22 13:16:41 (20130522131641) Neos.Media                      migrated
    > 2013-05-22 13:28:35 (20130522132835) Neos.Media                      migrated
    > 2013-06-05 17:47:12 (20130605174712) Neos.Media                      migrated
    > 2014-11-18 17:23:22 (20141118172322) Neos.Media                      migrated
    > 2015-02-28 15:42:01 (20150228154201) Neos.Media                      migrated
    > 2015-03-24 18:50:18 (20150324185018) Neos.Media                      migrated
    > 2015-05-07 20:44:50 (20150507204450) Neos.Media                      migrated
    > 2015-07-01 11:32:46 (20150701113246) Neos.Media                      migrated
    > 2015-09-13 17:38:32 (20150913173832) Neos.Media                      not migrated
    > 2015-12-16 05:23:38 (20151216052338) Neos.Media                      not migrated
    > 2015-12-16 14:37:56 (20151216143756) Neos.Media                      not migrated
    > 2015-12-16 14:44:08 (20151216144408) Neos.Media                      not migrated
    > 2016-02-23 16:56:02 (20160223165602) Neos.Media                      not migrated
    > 2016-11-25 09:38:10 (20161125093810) Neos.Media                      not migrated
    > 2016-11-25 17:22:23 (20161125172223) Neos.Media                      not migrated
    > 2017-01-10 13:02:17 (20170110130217) Neos.Media                      not migrated

(Soren Malling) #6

Perhaps try

./flow media:clearthumbnails
./flow media:createthumbnails

to clear and create thumbnails - that will be my best guess on how to fill the tables with missing data


(Thomas Grabietz) #7

nice, this works!