sql - MYSQL error no 121. Supports transactions, row-level locking, and foreign keys -
has no error I run the script below I What's wrong with a script?
- -------------------------- ------------- -------------- table `commitment '-------------------------------- ---------------------- Create 'existing commitment' (if `id` is not present) Create INT (11) No NULL AUTO_INCREMENT,` type` CHAR ( 1) NULL default '0' comment '0: Eco-commitment | 1: Community Commitment | Etc ', `title` VARCHAR (180) zero zero default,` description` text zero default zero, `createdById` INT (11) NOT NULL default -1,` createdAt` timestamp not NULL default' 0000-00-00 00: to 00:00 ', `updatedById` INT (11) at zero default zero,` updatedAt` TIMESTAMP update CURRENT_TIMESTAMP zero default zero, `status` TINYINT (1) not nULL default 1 comment' 0: destroy | 1: Active | 2: inactive | 3: pending | 4: Blocked | 5: Suspended | Etc. ', PRIMARY KEY ( `Id`), Suckank` idxCreatedById` (` createdById` ASC), Suckank` idxUpdatedById` ( `updatedById` ASC), Badha` fkProductUser1` foreign key (` createdById`) to Sndrb` User` ( `I DELETE no action DELETE action updated on D`), the barrier` fkProductUser2` foreign key ( `updatedById`) rEFERENCES` User` ( `Id`) take any action to date no action) Engine = InnoDB default character set = UTF8 counterattack = Utf8_unicode_ci;
error code indicates that the foreign key name already in use
- Key type (IDX, FK, ...) What do I want to do, to make an important unique and memorabilia,
- table name
- Local column name
- Referenced column name (or referenced table)
In your case, your foreign key can be
fk_commitment_createdbyid_user_id fk_commitment_updatedbyid_user_id
Comments
Post a Comment