I am running following query throgh phpMyAdmin:
**CREATE TABLE folders (
folder_id SERIAL NOT NULL,
parent_id BIGINT,
folder_name TEXT NOT NULL,
PRIMARY KEY (folder_id),
FOREIGN KEY (parent_id) REFERENCES folders(folder_id) ON DELETE CASCADE
)ENGINE=InnoDB;**
but it is giving the following error:
#1005 – Can’t create table ‘filesharingnew.folders’ (errno: 150)
Any idea where I am wrong?
From MySQL docs, Numeric Type Overview:
You should change
parent_idintoBIGINT UNSIGNEDso it matches the referenced column.