All shop related tables in own database except users table

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!
schoelli
Posts: 15
Joined: 25 Oct 2017, 17:21

All shop related tables in own database except users table

Post by schoelli » 10 Nov 2017, 11:29

I have installed Aimeos 2017.10 in my existing Laravel 5.4 project. I want to have all shop tables in an "aimeos" database, just the users table should be taken from my existing Laravel project. How can I setup this configuration?

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

Re: All shop related tables in own database except users tab

Post by aimeos » 10 Nov 2017, 11:51

Here's the documentation: https://aimeos.org/docs/Laravel/Several_databases

Configure the "db" resource to point to your Aimeos database and the "db-customer" resource to your main database. There will be three tables that are related to the users table (users_address, users_list and users_list_type) which have to stay together with the users table because of the foreign key constraints.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

schoelli
Posts: 15
Joined: 25 Oct 2017, 17:21

Re: All shop related tables in own database except users tab

Post by schoelli » 14 Nov 2017, 11:51

Okay, thanks! How can I migrate the existing shop to the new configuration? Simply rerun php artisan aimeos:setup? Or do I have to copy some tables from the aimeos database to the Laravel project database? Or do I have to setup the shop from scratch?

And are the mshop_customer_* tables also part in the db-customer resource?

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

Re: All shop related tables in own database except users tab

Post by aimeos » 14 Nov 2017, 20:57

After configuring the databases, you can simply run "./artisan aimeos:setup" to create the tables in the new database. If you already added products, you can export and import the table content.

Yes, the mshop_customer* tables belong to the db-customer resource. But they are not used because in Laravel, only the users* tables are used
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

schoelli
Posts: 15
Joined: 25 Oct 2017, 17:21

Re: All shop related tables in own database except users tab

Post by schoelli » 16 Nov 2017, 15:23

Thanks, setting up the db-customer configuration and ./artisan aimeos:setup worked. It also keeps my existing product tables untouched.

One thing I noticed is that the mshop_customer* tables are also created in my project database. When I deleted the mshop_customer_group table, aimeos crashed. So there is still a dependency on this table.

An issue I have is that the aimeos admin inferface for editing a customer overwrites the users.name column with the email address of the user. Can I change this behavior?

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

Re: All shop related tables in own database except users tab

Post by aimeos » 16 Nov 2017, 21:14

schoelli wrote: One thing I noticed is that the mshop_customer* tables are also created in my project database. When I deleted the mshop_customer_group table, aimeos crashed. So there is still a dependency on this table.
The mshop_customer_group table is still necessary because it contains the user groups for the Aimeos permission system. It would not make sense to create a users_group table which is only a duplicate of mshop_customers_group.
schoelli wrote: An issue I have is that the aimeos admin inferface for editing a customer overwrites the users.name column with the email address of the user. Can I change this behavior?
You can overwrite the saveItem() method of the customer manager and use a different SQL statement:
- https://github.com/aimeos/ai-laravel/bl ... l.php#L297
- https://github.com/aimeos/ai-laravel/bl ... r.php#L275
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply