Sqlite - default timestamp to be `now + a few days`
datetime, sqlite
Solution
Yes it can be done as in the following example:
sqlite> create table foo (i int, j text default (datetime('now', '+5 days')));
sqlite> insert into foo (i) values (1);
sqlite> select * from foo;
1|2012-04-11 07:49:04
sqlite> insert into foo (i) values (2);
sqlite> select * from foo;
1|2012-04-11 07:49:04
2|2012-04-11 07:49:14
If you only want to store the date part, use `date` instead of `datetime`. Here I use `datetime` to show that the default expression is evaluated when inserting in the table, not when the table is created.
Problem
I am trying to have a column holding the timestamp value whose default value is `today + a few days`. Could this be done during table creation time?