CREATE TABLE `category` (`id_category` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(255) NOT NULL ) ENGINE = InnoDB;
CREATE TABLE `product` (`id_product` INT NOT NULL AUTO_INCREMENT PRIMARY KEY, `name` VARCHAR(255) NOT NULL, `describe` TEXT, `photo_url` VARCHAR(255), `price` FLOAT, `category_id` INT DEFAULT 6, INDEX (`category_id`), CONSTRAINT `category_id_foreign` FOREIGN KEY (`category_id`) REFERENCES `category`(`id_category`) ON UPDATE CASCADE ON DELETE SET DEFAULT ) ENGINE = InnoDB;
i wywala mi blad. Ale to oczywiste bo znalazlem taka informacje
Cytat
SET DEFAULT: This action is recognized by the parser, but InnoDB rejects table definitions containing ON DELETE SET DEFAULT or ON UPDATE SET DEFAULT clauses.
i tu moje pytanie. Jak moge to zrobic ze przy usuwaniu rekordu z `category` ustawia mi sie wartosc domyslna w `product`?