Foreign Key on Setup
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!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Foreign Key on Setup
I have the following error when installing and I get to installing the demo data. I have made the amendments to config/database.php. It is Larvel 5.8 on Linux.
SQLSTATE[HY000]: General error: 1005 Can't create table `tdbhosti_demoshop`.`users_address` (errno: 150 "Foreign key constraint is incorrectly formed")
Re: Foreign Key on Setup
What's the charset and collation of your "users" table? What are the table options in your ./config/database.php file?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Foreign Key on Setup
I copied the changes from your instructions:
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
'mysql' => [
'driver' => 'mysql',
'url' => env('DATABASE_URL'),
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'unix_socket' => env('DB_SOCKET', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'prefix_indexes' => true,
'strict' => true,
'engine' => null,
'options' => extension_loaded('pdo_mysql') ? array_filter([
PDO::MYSQL_ATTR_SSL_CA => env('MYSQL_ATTR_SSL_CA'),
]) : [],
],
Re: Foreign Key on Setup
Can you please post the output of
Code: Select all
SHOW CREATE TABLE `users`
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Foreign Key on Setup
from Navicat's table information:
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`superuser` smallint(6) NOT NULL DEFAULT 0,
`siteid` int(11) DEFAULT NULL,
`label` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`salutation` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`company` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`vatid` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`title` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`firstname` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`lastname` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`address1` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`address2` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`address3` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`postal` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`city` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`state` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`langid` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
`countryid` char(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`telephone` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`telefax` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`website` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`longitude` decimal(8,6) DEFAULT NULL,
`latitude` decimal(8,6) DEFAULT NULL,
`birthday` date DEFAULT NULL,
`vdate` date DEFAULT NULL,
`status` smallint(6) NOT NULL DEFAULT 1,
`editor` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`),
KEY `idx_lvusr_langid` (`langid`),
KEY `idx_lvusr_last_first` (`lastname`,`firstname`),
KEY `idx_lvusr_post_addr1` (`postal`,`address1`),
KEY `idx_lvusr_post_city` (`postal`,`city`),
KEY `idx_lvusr_lastname` (`lastname`),
KEY `idx_lvusr_address1` (`address1`),
KEY `idx_lvusr_city` (`city`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `users` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`email_verified_at` timestamp NULL DEFAULT NULL,
`password` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`remember_token` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
`created_at` datetime NOT NULL,
`updated_at` datetime NOT NULL,
`superuser` smallint(6) NOT NULL DEFAULT 0,
`siteid` int(11) DEFAULT NULL,
`label` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`salutation` varchar(8) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`company` varchar(100) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`vatid` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`title` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`firstname` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`lastname` varchar(64) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`address1` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`address2` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`address3` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`postal` varchar(16) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`city` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`state` varchar(200) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`langid` varchar(5) COLLATE utf8_unicode_ci DEFAULT NULL,
`countryid` char(2) COLLATE utf8_unicode_ci DEFAULT NULL,
`telephone` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`telefax` varchar(32) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`website` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
`longitude` decimal(8,6) DEFAULT NULL,
`latitude` decimal(8,6) DEFAULT NULL,
`birthday` date DEFAULT NULL,
`vdate` date DEFAULT NULL,
`status` smallint(6) NOT NULL DEFAULT 1,
`editor` varchar(255) COLLATE utf8_unicode_ci NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `users_email_unique` (`email`),
KEY `idx_lvusr_langid` (`langid`),
KEY `idx_lvusr_last_first` (`lastname`,`firstname`),
KEY `idx_lvusr_post_addr1` (`postal`,`address1`),
KEY `idx_lvusr_post_city` (`postal`,`city`),
KEY `idx_lvusr_lastname` (`lastname`),
KEY `idx_lvusr_address1` (`address1`),
KEY `idx_lvusr_city` (`city`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Re: Foreign Key on Setup
Which Aimeos version do you use?
Please make sure the columns "users.id" and "users_address.parentid", "users_list.parentid" "users_property.parentid" are using the same column definition. The easiest was would be to remove the "unsigned" from the users.id column.
Please make sure the columns "users.id" and "users_address.parentid", "users_list.parentid" "users_property.parentid" are using the same column definition. The easiest was would be to remove the "unsigned" from the users.id column.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Foreign Key on Setup
I removed the unsiqned from the users.id and the users_address.parentid was unsigned. The tables users_list.parentid and users_property.parentid are not there. I tried to rerun the setup command but got the same error.
I downloaded from composer yesterday. Composer is showing "aimeos/aimeos-laravel": "~2018.07"
I downloaded from composer yesterday. Composer is showing "aimeos/aimeos-laravel": "~2018.07"
Re: Foreign Key on Setup
You should use the latest version which is 2019.07.
All referenced columns need the same attributes so if users_address.parentid is unsigend, users.id have to be unsigend too.
What version of MySQL (or a derivate) are you using?
All referenced columns need the same attributes so if users_address.parentid is unsigend, users.id have to be unsigend too.
What version of MySQL (or a derivate) are you using?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Foreign Key on Setup
I manually changed the version in composer.json (but this was only installed yesterday via composer so you may wish to look at this) and ran an update. It updated to the later version.
I tried php artisan aimeos:setup --option=setup/default/demo:1 but got the same error.
My version of mySQL is MariaDB
10.2.26-MariaDB-log-cll-lve - MariaDB Server
I tried php artisan aimeos:setup --option=setup/default/demo:1 but got the same error.
My version of mySQL is MariaDB
10.2.26-MariaDB-log-cll-lve - MariaDB Server
Re: Foreign Key on Setup
Can you please drop your database and rerun again so we have a clean state?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star