You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have a Message resource that I would like to delete. I deleted the code and ran the mix ash_postgres.generate_migrations --name remove_message_resource but that came back with:
Extension Migrations:
No extensions to install
Generating Tenant Migrations:
Generating Migrations:
No changes detected, so no migrations or snapshots have been created.
Describe the solution you'd like
I would expect it to detect that a resource has been deleted and create the migration.
Describe alternatives you've considered
creating the migration using mix ecto.gen.migration remove_messaage_table seems to have worked.
Additional context
Chat about this idea in discord: Zi Makki — Today at 14:09
I have a Message resource that I would like to delete. I deleted the code and ran the mix ash_postgres.generate_migrations --name remove_message_resource but that came back with:
Extension Migrations:
No extensions to install
Generating Tenant Migrations:
Generating Migrations:
No changes detected, so no migrations or snapshots have been created.
What is the ash way of deleting a resource and creating a migration to delete the db table?
barnabasj — Today at 15:00
It's possible that it's not diffing for removed Resources. But you can always just use the regular Ecto tasks to create a migration and drop the table there.
Zi Makki — Today at 15:17
ah ok... so I don't need to do anything "special" re the snapshots?
barnabasj — Today at 15:44
In this case it shouldn't make a difference as you already ran the generator and it did nothing.
I built something with ash where there was already an existing database and I built not all of the old stuff at the beginning but also added some new stuff. That way the things got sometimes a bit out of sync. But what I did from time to time was run the migration generator to update the snapshots and deleted the generated migrations. Next time you run the generator after things should be fine again.
But as said in the beginning it shouldn't be a problem in your case
If you add the same resource again in the future it would probably only create migrations for the diffs between the resource when you deleted it and the version you added again.
A GitHub issue would still be appreciated to track this and maybe integrate something for it
The text was updated successfully, but these errors were encountered:
zachdaniel
changed the title
mix ash_postgres.generate_migration does nothing if a resource has been removed/deleted
drop tables on resources being missing
Mar 20, 2024
I think the difference between renaming/dropping is big enough to be separate issues. I also admire the developer willing to tackle it as a first issue!
Is your feature request related to a problem? Please describe.
I have a
Message
resource that I would like to delete. I deleted the code and ran themix ash_postgres.generate_migrations --name remove_message_resource
but that came back with:Describe the solution you'd like
I would expect it to detect that a resource has been deleted and create the migration.
Describe alternatives you've considered
creating the migration using
mix ecto.gen.migration remove_messaage_table
seems to have worked.Additional context
Chat about this idea in discord:
Zi Makki — Today at 14:09
barnabasj — Today at 15:00
Zi Makki — Today at 15:17
barnabasj — Today at 15:44
The text was updated successfully, but these errors were encountered: