modmapper/migrations/20210729031521_add_downloaded_at_to_files.sql

8 lines
375 B
SQL

ALTER TABLE "files" ADD COLUMN "downloaded_at" TIMESTAMP(3);
/* Backfill existing columns using the created_at timestamps.
*
* This is approximate since usually the file was downloaded shortly after the record was created.
* I mostly only care whether it is null or not null. All existing files need non-null values.
*/
UPDATE "files" SET "downloaded_at" = "created_at";