I'm trying this query
DROP TABLE IF EXISTS Core;
on a table created with this query
CREATE TABLE Core (
id serial PRIMARY KEY,
title varchar(512),
kind ENUM('User', 'Organisation', 'Channel', 'Collection', 'Text', 'Picture', 'Sound', 'Video', 'UserGroup'),
is_activated BOOLEAN DEFAULT true,
date_created DATETIME DEFAULT CURRENT_TIMESTAMP,
date_updated DATETIME,
date_augmented DATETIME,
author_core BIGINT UNSIGNED NOT NULL,
FOREIGN KEY (author_core) REFERENCES Core(id) ON DELETE CASCADE
)
but i get the error #1217 - A foreign key constraint fails
.
I know the dirty workaround that is disabling the foreign key check with
SET foreign_key_checks = 0;
but i'm still wondering why the ON DELETE CASCADE
of the field author_core
is not doing its job.