I have an sqlite database which currently holds an integer field called Year which currently only stores the year. In future versions I want to store a full date and time.
I updated my table to include a FullDate field using alter table.
> ALTER TABLE Files ADD COLUMN UploadDate DATETIME DEFAULT 0;
Next, I want to migrate all the existing year fields to the new field. So I'm looking for something like:
> UPDATE Files SET UploadDate = (DATETIME('%Y-%m-%d', Year, 1, 1));
Unfortunately this doesn't seem to work as the result is empty. I also tried the date and strftime functions but they either result in incorrect data or empty data.
What's the proper way to update a DATETIME field with existing data in the same table?