-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Admin Panel Not Loading When Using Two Different Databases one for aimeos and other for laravel base database. #505
Comments
This won't work because it must be
|
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 then I run I need to run aimeos table in seperate database and main project database should be diffferent. |
This will happen if you run |
@aimeos, No, I have executed Screen.Recording.2024-06-21.at.10.44.07.AM.mov |
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 kitloong/laravel-migrations-generator#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
The text was updated successfully, but these errors were encountered: