beam-automigrate icon indicating copy to clipboard operation
beam-automigrate copied to clipboard

Spurious migrations caused by date formatting

Open cgibbard opened this issue 2 months ago • 0 comments

In the case of a default column constraint being set on a timestamp with time zone column, the comparison between the value as reported to beam-automigrate by postgres and the value that is produced by beam/postgresql-simple never agree.

This really has two issues: postgres seems to report the timestamp using the session timezone, so one way in which it's presently fragile is that we're not being careful to set the timezone to UTC before reading the schema.

Secondly, when postgres reports a timestamp in UTC, it gives the timezone as +00 (zero offset) rather than having a trailing Z (Zulu time indicator). Both of these seem like valid ways to format an ISO timestamp and refer to the same thing, but of course, string comparison fails.

Possibly we could be more type sensitive here and parse the timestamps in this case in order to be able to compare them as UTCTime values.

cgibbard avatar Apr 23 '24 16:04 cgibbard