-- +goose Up
ALTER TABLE duls
  ADD COLUMN IF NOT EXISTS date DATE NULL AFTER name;

UPDATE duls
SET date = COALESCE(date, DATE(created_at), CURRENT_DATE())
WHERE date IS NULL;

ALTER TABLE duls
  MODIFY COLUMN date DATE NOT NULL;

-- +goose Down
ALTER TABLE duls
  DROP COLUMN IF EXISTS date;
