ERROR running doctrine:migrate after installing neos/googleanalytics

Can anyone help me to fix this?
What i did:

  1. Installing neos/googleanalytics 2.0.1 on my Neos 3.0.3 installation.

  2. On the ./neos/administration/googleAnalytics Page got a error:
    #0: A table or view seems to be missing from the database.

  3. running doctrine:migrate and got the following error:

    `Exception in line 128 of /var/www/Packages/Libraries/doctrine/dbal/lib/Doctrine/DBAL/DBALException.php: An exception occurred while executing ‘ALTER TABLE typo3_neos_googleanalytics_domain_model_siteconfiguration ADD CONSTRAINT FK_D675F674694309E4 FOREIGN KEY (site) REFERENCES typo3_neos_domain_model_site (persistence_object_identifier) ON DELETE CASCADE’:

    SQLSTATE[HY000]: General error: 1005 Can’t create table neos.#sql-38b_90 (errno: 150 “Foreign key constraint is incorrectly formed”)

I remember I came across some similar issue when upgrading to 3.0.x. It had to do with some naming where the table typo3_neos_googleanalytics_domain_model_siteconfiguration already got renamed to neos... while in the doctrine migration it is still called typo3... I ended up copying the raw sql from the migration, rename typo3 to neos and run it manually in the database. Can’t remember what I did exactly, but maybe this is enough to give you a hint.

1 Like

Would you mind opening an issue in the issue tracker for the package? https://github.com/neos/neos-googleanalytics/issues

Thank you :slight_smile:

done: https://github.com/neos/neos-googleanalytics/issues/22

thanks i fixed it manually

1 Like

Could you write the exact steps you did to fix the issue? Could be a great help for others and the person fixing the issue, knowing what you did :slight_smile:

i copied the sql structure from a fresh neos_googleanalytics_domain_model_siteconfiguration table and created the table manually:

   create table neos_googleanalytics_domain_model_siteconfiguration
(
	persistence_object_identifier varchar(40) not null
		primary key,
	site varchar(40) null,
	profileid varchar(255) not null,
	trackingid varchar(255) not null,
	constraint FK_DACC5FD9694309E4
		foreign key (site) references neos_neos_domain_model_site (persistence_object_identifier)
			on delete cascade
)
;

create index IDX_D675F674694309E4
	on neos_googleanalytics_domain_model_siteconfiguration (site)
;

How will that affect the next time you run ./flow doctrine:migrate?

I believe, that if you don’t add the migration number to the migrationstatus table, it will try and run the migration again, the next time.

thats right,
when you run doctrine:migrate --output you see all the cahnges you have to do, to got the correct status. but i havn’d tried it out yet.