Skip to content

Commit 63bb540

Browse files
authored
feat: Drop tables on missing resources & table name change handling (#713)
1 parent 99952f9 commit 63bb540

File tree

14 files changed

+1019
-107
lines changed

14 files changed

+1019
-107
lines changed

documentation/topics/development/migrations-and-tasks.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ dev migrations and run them.
2525

2626
For more information on generating migrations, run `mix help ash_postgres.generate_migrations` (the underlying task that is called by `mix ash.migrate`)
2727

28+
When you remove a resource from your domain, run the migration generator (e.g. `mix ash_postgres.generate_migrations --name remove_my_resource`). It will generate a migration to drop the table and remove the snapshot for that table.
29+
30+
When you rename a resource's table (e.g. change the `table "..."` in the `postgres do` block), the generator will ask whether you are renaming the table. If you answer yes, it generates a single `rename table(...), to: table(...)` migration so the table is renamed in place and data and foreign keys are preserved.
31+
2832
> ### all_tenants/0 {: .info}
2933
>
3034
> If you are using schema-based multitenancy, you will also need to define a `all_tenants/0` function in your repo module. See `AshPostgres.Repo` for more.

0 commit comments

Comments
 (0)