Skip to content

fix: include manual create actions in has_create_action?/1 - #913

Closed
hoanle0126 wants to merge 1 commit into
ash-project:mainfrom
hoanle0126:fix/has-create-action-manual-creates-851
Closed

hoanle0126 wants to merge 1 commit into
ash-project:mainfrom
hoanle0126:fix/has-create-action-manual-creates-851

Conversation

@hoanle0126

Copy link
Copy Markdown

Summary

has_create_action?/1 in AshPostgres.MigrationGenerator previously excluded create actions that set manual. Because extensions like AshEvents wrap resource create actions as manual actions, resources using AshEvents reported has_create_action: false, causing count_with_create to be 0 when multiple evented resources share a table and marking subtype-specific allow_nil?: false columns as null: false in generated migrations.

Since manual create actions still insert rows into the underlying table, this updates has_create_action?/1 to count all :create actions regardless of whether manual is set.

Closes #851

Contributor Checklist

@zachdaniel

Copy link
Copy Markdown
Contributor

I don't think this is right. It's not a given that a manual create action interacts with the data layer. See my comment on that issue:

Yeah this is a bit of a head-scratcher architecturally. We want that check in general but we may need to add a special option just for this case like always_create_migrations? true 😓. It's not ideal. Can you talk with @Torkan in an AshEvents issue and see what he thinks?

@zachdaniel zachdaniel closed this Oct 31, 2026
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.

has_create_action?/1 excludes manual creates, making the #49 nullability fix inert on AshEvents resources

2 participants