I have a users table and a friendship table, a friend is also a user and when I add a user as a friend it also has to be my friend, now that the concept is clear, I would like to know how do I create this table , because the following error is occurring:
CREATE TABLE IF NOT EXISTS postagens(
id INT NOT NULL AUTO_INCREMENT,
u_id INT,
titulo VARCHAR(128) NOT NULL,
conteudo VARCHAR(4096),
imagem VARCHAR(256),
audio VARCHAR(256),
video VARCHAR(256),
CONSTRAINT id_pk PRIMARY KEY(id),
CONSTRAINT u_id_fk FOREIGN KEY(u_id) REFERENCES usuarios(id)
) DEFAULT CHARSET=utf8;
CREATE TABLE IF NOT EXISTS amizade(
id INT NOT NULL AUTO_INCREMENT,
u_id INT,
a_id INT,
CONSTRAINT id_pk PRIMARY KEY(id),
CONSTRAINT u_id_fk FOREIGN KEY(u_id) REFERENCES usuarios(id),
CONSTRAINT a_id_fk FOREIGN KEY(a_id) REFERENCES usuarios(id)
) DEFAULT CHARSET=utf8;