Need to change the database schema

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
kdim95
Advanced
Posts: 196
Joined: 26 Aug 2022, 12:17

Re: Need to change the database schema

Post by kdim95 » 07 Apr 2023, 09:16

aimeos wrote: 07 Apr 2023, 08:36 The problem might be that the demo data isn't removed before importing it again and therefore, the exact same row causes the problem now.

Each customer can add only one review for each product and this is ensured by the constraint.
Hello,

I thought that you need to add more parameters to php artisan aimeos:setup for it to install the demo data.
I don't want to install the demo data, just run database migrations, this is also required if I make changes to the ElasticSearch config, like max_result_window. php artisan aimeos:setup updates the ElasticSearch index config.

I want customers to be able to add multiple reviews to the same product and not have to remove that database change when it's required to execute the php artisan aimeos:setup command.

Is here no way to override vendor/aimeos/aimeos-core/setup/default/schema/review.php so that php artisan aimeos:setup reads from the overriden file itself?

So far the only thing I've come up with is changing the original file:
vendor/aimeos/aimeos-core/setup/default/schema/review.php

This works, but if there is an update, the changes to this file will be removed, and I will get "Integrity constraint violation" again, and I will have to modify the original file again, which I want to avoid and override it instead.

User avatar
aimeos
Administrator
Posts: 7873
Joined: 01 Jan 1970, 00:00

Re: Need to change the database schema

Post by aimeos » 11 Apr 2023, 07:00

You can add a setup/default/schema/review.php file in your own Aimeos extension and there, you can remove the unique index:
https://github.com/aimeos/aimeos-core/b ... ew.php#L28

Code: Select all

$this->dropIndex( 'mshop_review', 'unq_msrev_cid_dom_rid_sid' );
This should be done before the table migration is executed.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply