I am trying to set a DEFAULT value and NOT NULL for type_id column which is a foreign key to instance table but it is complaining about MySQL syntax.
CREATE TABLE `type` (
`id` int(10) unsigned NOT NULL PRIMARY KEY AUTO_INCREMENT,
`city` varchar(256)
);
ALTER TABLE instance ADD COLUMN type_id int(10) unsigned NOT NULL;
ALTER TABLE instance ADD CONSTRAINT instance_xbf1 DEFAULT 1
FOREIGN KEY (type_id)
REFERENCES type(id) int(10) unsigned NOT NULL;
It is complaining about the syntax of the last statement:
Error: \"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'DEFAULT 1\nFOREIGN KEY (type_id)\nREFERENCES type(id) int(10) unsi' at line 1\")", "stdout": "", "stdout_lines": [], "warnings": []}
it is complaining about mysql syntaxThose complaints contain very specific messages that tell you exactly what the error is.