Incident: Timezone with and Timezone without (December 2018) - nbw/treelib_elixir GitHub Wiki

When converting from Phoenix 1.3 to 1.4 it became evident that the inserted_at and updated_at columns in Prod were with timezone when in fact Elixir passes a NaiveDateTime and expects without timezone.

To deal with the issue I altered table column types manually (yeah - totally safe right?) with:

ALTER TABLE species ALTER COLUMN inserted_at TYPE TIMESTAMP WITHOUT TIME ZONE;
ALTER TABLE species ALTER COLUMN updated_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE genera ALTER COLUMN inserted_at TYPE TIMESTAMP WITHOUT TIME ZONE;
ALTER TABLE genera ALTER COLUMN updated_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE families ALTER COLUMN inserted_at TYPE TIMESTAMP WITHOUT TIME ZONE;
ALTER TABLE families ALTER COLUMN updated_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE photos ALTER COLUMN inserted_at TYPE TIMESTAMP WITHOUT TIME ZONE;
ALTER TABLE photos ALTER COLUMN updated_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE photo_albums ALTER COLUMN inserted_at TYPE TIMESTAMP WITHOUT TIME ZONE;
ALTER TABLE photo_albums ALTER COLUMN updated_at TYPE TIMESTAMP WITHOUT TIME ZONE;

ALTER TABLE schema_migrations ALTER COLUMN inserted_at TYPE TIMESTAMP WITHOUT TIME ZONE;