Чтобы удалить таблицу towns мне сначала приходится удалить citizens. Какой смысл тогда в ON DELETE CASCADE?
CREATE TABLE IF NOT EXISTS towns
(
name VARCHAR(24) DEFAULT 0 NOT NULL,
mayor VARCHAR(24) DEFAULT 0 NOT NULL,
`timestamp` BIGINT DEFAULT 0 NOT NULL,
PRIMARY KEY(name)
);
CREATE TABLE IF NOT EXISTS citizens
(
town VARCHAR(24),
name VARCHAR(24) DEFAULT 0 NOT NULL,
uuid CHAR(36) DEFAULT 0 NOT NULL,
PRIMARY KEY(name),
FOREIGN KEY (town) REFERENCES towns(name) ON DELETE CASCADE
);
insert into towns (name, mayor, timestamp) values ('Town', 'Name', 1625428916539);
insert into citizens (town, name, uuid) values ('Town', 'Name', 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa');