fdisotto / SlimBlog

Simple Blog written with Slim Framework
GNU General Public License v3.0
102 stars 39 forks source link

.SQL bug #31

Closed Selenuix closed 7 years ago

Selenuix commented 7 years ago

Hello,

I cloned the repo and when I try to import the slimblog.sql in phpmyadmin, I got an error :

Error

SQL query:

CREATE TABLE IF NOT EXISTS comments ( id int(11) NOT NULL AUTO_INCREMENT, username varchar(50) NOT NULL, url varchar(50) NOT NULL, email varchar(50) NOT NULL, text text NOT NULL, posts_id int(11) NOT NULL, created_at timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (id), KEY FK__posts (posts_id), CONSTRAINT FK__posts FOREIGN KEY (posts_id) REFERENCES posts (id) ON DELETE NO ACTION ON UPDATE NO ACTION ) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=latin1

MySQL said: Documentation

1215 - Cannot add foreign key constraint

I don't know what's wrong, but please fix it :D

fdisotto commented 7 years ago

Try creating posts table first.