I’m facing the same problem. I’m using docker:latest and using mariadb too…
You from n8n team must check docker image… this image is coming with the ‘CreateLdapEntities1674509946020’ migration.
The problem is this migration query:
CREATE TABLE IF NOT EXISTS `auth_identity` (
`userId` VARCHAR(36) REFERENCES `user`(id),
`providerId` VARCHAR(64) NOT NULL,
`providerType` VARCHAR(32) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`providerId`, `providerType`)
) ENGINE='InnoDB';
The creation of this table is showing me the error
Error in foreign key constraint of table n8n
.auth_identity
:
Create table n8n
.auth_identity
with foreign key (userId) constraint failed. Field type or character set for column ‘userId’ does not match referenced column ‘id’
The DDL of my table user is
CREATE TABLE `user` (
`id` varchar(36) NOT NULL,
`email` varchar(255) DEFAULT NULL,
`firstName` varchar(32) DEFAULT NULL,
`lastName` varchar(32) DEFAULT NULL,
`password` varchar(255) DEFAULT NULL,
`resetPasswordToken` varchar(255) DEFAULT NULL,
`resetPasswordTokenExpiration` int(11) DEFAULT NULL,
`personalizationAnswers` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`createdAt` datetime NOT NULL DEFAULT current_timestamp(),
`updatedAt` datetime NOT NULL DEFAULT current_timestamp(),
`globalRoleId` int(11) NOT NULL,
`settings` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
`apiKey` varchar(255) DEFAULT NULL,
`disabled` tinyint(1) NOT NULL DEFAULT 0,
PRIMARY KEY (`id`),
UNIQUE KEY `IDX_e12875dfb3b1d92d7d7c5377e2` (`email`),
UNIQUE KEY `UQ_ie0zomxves9w3p774drfrkxtj5` (`apiKey`),
KEY `FK_f0609be844f9200ff4365b1bb3d` (`globalRoleId`),
CONSTRAINT `FK_f0609be844f9200ff4365b1bb3d` FOREIGN KEY (`globalRoleId`) REFERENCES `role` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3
To fix this, I executed manually the query with this additional parameter
CREATE TABLE IF NOT EXISTS `auth_identity` (
`userId` VARCHAR(36) CHARACTER SET utf8mb3 REFERENCES `user` (id),
`providerId` VARCHAR(64) NOT NULL,
`providerType` VARCHAR(32) NOT NULL,
`createdAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
`updatedAt` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(`providerId`, `providerType`)
) ENGINE='InnoDB';
I can’t remember if I changed charset of this table in the past, but my mariadb instance uses the default charset utf8mb4
I don’t know if this is a bug from n8n with mariadb…