Setting using DEFAULT CURRENT_TIMESTAMP not working in d1?

As of sqlite 3.1.0, sqlite supports columns with DEFAULT CURRENT_TIMESTAMP but I get the following error when trying to use it:

ERROR 9015: SQL engine error: failed to read next row: Cannot add a column wit│
 non-constant default [code: 7500]

Here’s an example of code that could trigger the error (e.g. in a migration file)

ALTER TABLE "users" ADD COLUMN created_at DATETIME DEFAULT CURRENT_TIMESTAMP;
1 Like