Closed siddharthghedia closed 2 months ago
This won't work because it must be env('DB_AIMEOS_...')
:
'host' => config('DB_AIMEOS_HOST', 'localhost'),
'port' => config('DB_AIMEOS_PORT', '3306'),
'database' => config('DB_AIMEOS_DATABASE', ''),
'username' => config('DB_AIMEOS_USERNAME', ''),
'password' => config('DB_AIMEOS_PASSWORD', ''),
Works without problem when using this configuration in ./config/shop.php in combination with your ./config/database.php and .env settings:
'db' => [
'adapter' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.driver', 'mysql' ),
'host' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.host', '127.0.0.1' ),
'port' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.port', '3306' ),
'socket' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.unix_socket', '' ),
'database' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.database', 'forge' ),
'username' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.username', 'forge' ),
'password' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.password', '' ),
'stmt' => config( 'database.default', 'mysql' ) === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
'limit' => 3, // maximum number of concurrent database connections
'defaultTableOptions' => [
'charset' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.charset' ),
'collate' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.collation' ),
],
'driverOptions' => config( 'database.connections.' . config( 'database.default', 'mysql' ) . '.options' ),
],
'db-customer' => [
'adapter' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.driver', 'mysql' ),
'host' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.host', '127.0.0.1' ),
'port' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.port', '3306' ),
'socket' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.unix_socket', '' ),
'database' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.database', 'forge' ),
'username' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.username', 'forge' ),
'password' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.password', '' ),
'stmt' => config( 'database.default', 'mysql_aimeos' ) === 'mysql' ? ["SET SESSION sort_buffer_size=2097144; SET NAMES 'utf8mb4'; SET SESSION sql_mode='ANSI'"] : [],
'limit' => 3, // maximum number of concurrent database connections
'defaultTableOptions' => [
'charset' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.charset' ),
'collate' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.collation' ),
],
'driverOptions' => config( 'database.connections.' . config( 'database.default', 'mysql_aimeos' ) . '.options' ),
],
@aimeos , I have added db-customer and db in ./config/database.php and .env settings. Now, I am able to run admin panel of aimeos successfully. But at a time of fresh migration I encounter with foreign key errors in aimeos mshop_customer table with project base table.
After configuring all of the above setting, I run php artisan migrate
command which run successfully and migrate all base database tables which contains some of the aimeos tables such as mshop_customer
, mshop_customer_address
etc.
then I run php artisan aimeos:setup --option=setup/default/demo:1
command which gives below error.
I need to run aimeos table in seperate database and main project database should be diffferent.
This will happen if you run artisan aimeos:setup
before artisan migrate
@aimeos, No, I have executed artisan migrate
and then run artisan aimeos:setup
https://github.com/aimeos/aimeos-laravel/assets/5723637/4358d1e1-6cb0-4cc2-bc1d-7c983efde355
One of your migrations loads a complete database schema which causes the issue
What would you recommend here? That we generate migrations based on database schema? We pruned migrations and generated a dumb as a base to clean things up and allow for easier base app setup so would prefer to keep this.
We did try to generate migrations with a package to see if we can get passed this error . See https://github.com/kitloong/laravel-migrations-generator/issues/221 but now we are running into collation issues..
For development, it might be possible to import database dumps but only if it's the first migration that is executed. The dumps need to contain the two different databases (Laravel and Aimeos) and the setup must be exactly the same in all dev environments.
We are trying to work with migrations pre pruning now. Thanks for the suggestions. I am sure @siddharthghedia appreciates them too.
The admin panel fails to load when configuring Aimeos to use two different databases. When trying to open admin routes URL then gives an unauthorised access error.
I tried the following steps:
php artisan aimeos:account --super <email>
Additional context
After, above steps I am able to run Aimeos frontend and login. Also, display logged-in user details in frontend profile page but when I try to open admin routes then It says unauthorised to access the page.
I think actually the problem with role because of using different database. Aimeos table don't have users table. I also followed below steps but couldn't make it work. https://github.com/aimeos/aimeos-laravel/issues/267