Skip to content

Add timestamptz option - #874

Merged
zachdaniel merged 3 commits into
ash-project:mainfrom
omgitzjoe:add-timestamptz-option
Oct 1, 2026
Merged

zachdaniel merged 3 commits into
ash-project:mainfrom
omgitzjoe:add-timestamptz-option

Conversation

@omgitzjoe

Copy link
Copy Markdown
Contributor

Summary

Added an opt-in toggle to use timestamptz in Ash.Type.DateTime fields. Previous behavior is preserved for existing users.

Closes #264

Root cause

The default DateTime field uses timestamp (without time zones) and switching to timestamptz would fulfill best practices.

Changes

  • Added an opt-in timestamptz datetime toggle.
  • Added a test that verifies migration generator uses timestamptz with toggle enabled.
  • Added a test that verifies the runtime Ecto uses timestamptz when the toggle is enabled.
  • Added a test that verifies datetime values remain consistent when the timezone is changed.

How I tested it

  • Added a describe block containing the three tests and setup.
  • Test fails without this change: yes.
  • mix credo passes with line-ending consistency warnings on the modified files.
  • mix dialyzer passes locally.

Notes for reviewers

  • Toggle is disabled by default to allow for existing behavior to continue

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@zachdaniel

Copy link
Copy Markdown
Contributor

LGTM 👍 I see that its a draft, LMK (via a comment I don't get a notification when a PR stops being a draft) when its good to go on your end.

@omgitzjoe
omgitzjoe marked this pull request as ready for review September 29, 2026 18:37
@omgitzjoe

Copy link
Copy Markdown
Contributor Author

Right, it's should be good to go Zach.

@zachdaniel
zachdaniel merged commit 0203e9a into ash-project:main Oct 1, 2026
@zachdaniel

Copy link
Copy Markdown
Contributor

🚀 Thank you for your contribution! 🚀

@omgitzjoe
omgitzjoe deleted the add-timestamptz-option branch October 7, 2026 23:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Switch to using timestamp with time zone by default

2 participants