Perl-Evozon / PearlBee

116 stars 44 forks source link

Can't create posts when using SQLite #40

Closed andrewalker closed 8 years ago

andrewalker commented 8 years ago

When using SQLite as a backend, the created_date for the post can't be NULL. In MySQL, it uses the default CURRENT_TIMESTAMP.

DBI Exception: DBD::SQLite::st execute failed: NOT NULL constraint failed: post.created_date [for Statement "INSERT INTO post ( content, cover, created_date, slug, status, title, user_id) VALUES ( ?, ?, ?, ?, ?, ?, ? )"] at /Users/anwalker/Projects/PearlBee/local/lib/perl5/DBIx/Class/Schema.pm line 1077.

xsawyerx commented 8 years ago

The DEFAULT CURRENT_TIMESTAMP in SQLite works, unless you explicitly INSERT a NULL value:

http://stackoverflow.com/questions/14461851/how-to-have-an-automatic-timestamp-in-sqlite