ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE ON

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
chinar08
Posts: 7
Joined: 22 Dec 2021, 07:13

ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE ON

Post by chinar08 » 22 Dec 2021, 07:29

windows environment so using wamp server for server process
composer version 2.1.14
php version PHP 7.4.26
laravel version ^8.54
aimeos version 2021.10

I followed the below mentioned steps

1)wget https://getcomposer.org/download/latest ... poser.phar -O composer

2) config/database.php
'connections' => [
'mysql' => [
// ...
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
// ...
]
]

3)php composer create-project aimeos/aimeos myshop

but still facing the issue
https://ibb.co/gVK1ZdT
Image

How I can solve this problem,

chinar08
Posts: 7
Joined: 22 Dec 2021, 07:13

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by chinar08 » 22 Dec 2021, 07:31

please provide a solution on for this as early as possible

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

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by aimeos » 22 Dec 2021, 08:11

Is this a new installation of the Aimeos distribution, are you installing Aimeos into an existing Laravel application or does that happen when you update an Aimeos installation? What database and version do you use?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

chinar08
Posts: 7
Joined: 22 Dec 2021, 07:13

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by chinar08 » 22 Dec 2021, 09:57

aimeos wrote: 22 Dec 2021, 08:11 Is this a new installation of the Aimeos distribution, are you installing Aimeos into an existing Laravel application or does that happen when you update an Aimeos installation? What database and version do you use?
new installation and database mysql and version is 5.7.36
as per documentation for new installation command is -"php composer create-project aimeos/aimeos myshop"
and adding in preexisting project is-"php composer require aimeos/aimeos-laravel:~2021.10"

as soon as i run create project while running migration this issue comes .never got chance to run composer update or any other command as error comes on user related migrations

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

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by aimeos » 22 Dec 2021, 10:07

Please use only this command without anything else and make sure you have an empty database:

Code: Select all

php composer create-project aimeos/aimeos myshop
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

chinar08
Posts: 7
Joined: 22 Dec 2021, 07:13

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by chinar08 » 22 Dec 2021, 11:18

As you suggested directly run that command then i got "1071 Specified key was too long; max key length is 767 bytes"
in order to resolve this I tried again with config/databases.php
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
then i got same error:

SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE ON DELETE CASCADE

at D:\development\staging\myshop\vendor\aimeos\aimeos-core\lib\mwlib\src\MW\DB\Statement\DBAL\Simple.php:75
71▕ {
72▕ try {
73▕ $result = $this->exec();
74▕ } catch( \PDOException $e ) {
➜ 75▕ throw new \Aimeos\MW\DB\Exception( $e->getMessage() . ': ' . $this->sql, $e->getCode() );
76▕ }
77▕
78▕ return new \Aimeos\MW\DB\Result\PDO( $result );
79▕ }

1 D:\development\bubbly\myshop\vendor\aimeos\aimeos-core\lib\mwlib\src\MW\Setup\Task\Base.php:164
Aimeos\MW\DB\Statement\DBAL\Simple::execute()

2 D:\development\bubbly\myshop\vendor\aimeos\aimeos-core\lib\mshoplib\setup\TablesCreateMShop.php:177
Aimeos\MW\Setup\Task\Base::executeList("db-customer")

this time i followed as you said but isnt successful.
my mysql version is 5.7.36

https://ibb.co/fCTtQ72"
Image


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

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by aimeos » 22 Dec 2021, 11:51

Is it possible that your MySQL installation is creating MyISAM tables by default? The Laravel migration for its "users" table doesn't enforce InnoDB like the Aimeos code does for its tables. Therefore, creating the foreign key constraint may fail because MyISAM doesn't support them.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

chinar08
Posts: 7
Joined: 22 Dec 2021, 07:13

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by chinar08 » 22 Dec 2021, 12:32

yes as you mentioned i checked in db users,password,password resets,personal_access_tokens ,migrations,failed jobs has myisam type and rest is innodb .
can you kindly the locale related issue I am facing when i am install whole aimeos

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

Re: ALTER TABLE users_address ADD CONSTRAINT fk_lvuad_pid FOREIGN KEY (parentid) REFERENCES users (id) ON UPDATE CASCADE

Post by aimeos » 22 Dec 2021, 12:40

You have to make sure that the setup process completes without errors. Then, the required data will be there too.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply