Title: Web Development with Clojure, Third Edition, vB17.0 (p9)
The create table guestbook
syntax suggested doesn’t seem to be accepted by h2:
Syntax error in SQL statement "CREATE TABLE GUESTBOOK ( ID INTEGER PRIMARY KEY AUTO_INCREMENT[*], NAME VARCHAR(30), MESSAGE VARCHAR(30), TIMESTAMP TIMESTAMP DEFAULT CURRENT_TIMESTAMP );"; expected "HASH, AUTO_INCREMENT, NOT, NULL, COMMENT, CHECK, REFERENCES, ,, )"; SQL statement: create table guestbook ( id integer primary key auto_increment, name varchar(30), message varchar(30), timestamp timestamp default current_timestamp ); [42001-200]
From what I can tell, the problem is the order of clauses for the id
column. Putting auto_increment
before primary key
works as intended.
This applies to both the book and the downloadable source code.
The h2 documentation confirms this requirement.