ich die folgende Fehlermeldung erhalten:ERROR 1215 (HY000) in Zeile 13: fügen Sie kann nicht über Fremdschlüssel
ERROR 1215 (HY000) at line 13: Cannot add foreign key constraint
für die folgende Abfrage:
ALTER TABLE client_generique
ADD CONSTRAINT client_generique_boutique_id_boutique_id
FOREIGN KEY (boutique_id) REFERENCES boutique (id)
ON DELETE SET NULL;
Die boutique.id
ist ein primary key unique not null
.
Der phpMyAdmin Struktur Export der Boutique-Tabelle ist dies:
--
-- Table structure for table `boutique`
--
CREATE TABLE `boutique` (
`id` bigint(20) NOT NULL,
`nom` varchar(255) NOT NULL,
`identifiant_site` varchar(8) NOT NULL COMMENT 'the eight number identifier from the bank',
`certificate` varchar(255) NOT NULL COMMENT 'changes according to the mode, this will be used as salt in the sha1 that will be sent to the bank as the ''signature''',
`mode` varchar(10) NOT NULL COMMENT 'is the ''vads_ctx_mode'': TEST or PRODUCTION',
`payment_system` varchar(10) NOT NULL COMMENT 'CYBERPLUS OR PAYZEN for the new payment system added in end 2014'
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Indexes for table `boutique`
--
ALTER TABLE `boutique`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `unique_mode_per_identifiant_idx` (`identifiant_site`,`mode`);
Ich verstehe nicht. Was ist der Grund? Wie man dieses Problem löst?
Mit klaren Sätzen ist sehr nützlich, es ist nicht Ihre Schule Übungsheft. – peterh