Skip to content

fix: add dump_to_native fallback for migration defaults when safe#768

Open
CaydenLords wants to merge 1 commit into
ash-project:mainfrom
CaydenLords:main
Open

fix: add dump_to_native fallback for migration defaults when safe#768
CaydenLords wants to merge 1 commit into
ash-project:mainfrom
CaydenLords:main

Conversation

@CaydenLords
Copy link
Copy Markdown

@CaydenLords CaydenLords commented May 28, 2026

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

Fixes #527


:error ->
EctoMigrationDefault.to_default(value)
case migration_default_from_dump(type, Map.get(attr, :constraints, []), value) do
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 looking at this, I think this may unfortunately be a breaking change. I actually don't think we can/should do this. We have a callback available in AshPostgres.Type now like so:

  @callback value_to_postgres_default(Ash.Type.t(), Ash.Type.constraints(), term) ::
              {:ok, String.t()} | :error

This may not have been available when the person submitted that issue. So I think instead we should update our documentation in an appropriate place to explain this callback and then close the corresponding issue. Would you mind finding a good place to emphasize this callback?

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.

ash_postgres.generate_migrations not dumping_to_native when generating a default value

2 participants