mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
docs: add a migrations_and_tasks guide
This commit is contained in:
parent
fbc42ce87a
commit
1dd9df2a6c
2 changed files with 20 additions and 3 deletions
|
@ -1,9 +1,24 @@
|
|||
# Migrations
|
||||
|
||||
## Tasks
|
||||
|
||||
The available tasks are:
|
||||
|
||||
* `mix ash_postgres.create`
|
||||
* `mix ash_postgres.drop`
|
||||
* `mix ash_postgres.migrate` (use `mix ash_postgres.migrate --tenants` to run tenant migrations)
|
||||
|
||||
AshPostgres is built on top of ecto, so much of its behavior is pass-through/orchestration of that tooling.
|
||||
|
||||
For instance, you can use `mix ash_postgres.generate_migrations` to generate a snapshot and a migration to take
|
||||
your resources from the previous version to this version. For more information, see the module documentation here:
|
||||
## Basic Workflow
|
||||
|
||||
* Make resource changes
|
||||
* Run `mix ash_postgres.generate_migrations` to generate migrations and resource snapshots
|
||||
* Run `mix ash_postgres.migrate` to run those migrations
|
||||
* Run `mix ash_postgres.migrate --tenants` *as well* if you have multi-tenant resources.
|
||||
|
||||
|
||||
For more information on generating migrations, see the module documentation here:
|
||||
`Mix.Tasks.AshPostgres.GenerateMigrations`, or run `mix help ash_postgres.generate_migrations`
|
||||
|
||||
For running your migrations, there is a mix task that will find all of the repos configured in your apis and run their
|
||||
|
@ -16,4 +31,5 @@ For tenant migrations (see the multitenancy guides for more) generated by multit
|
|||
|
||||
## Multiple Repos
|
||||
|
||||
If you are using multiple repos, you will likely need to use `mix ecto.migrate` and manage it separately for each repo.
|
||||
If you are using multiple repos, you will likely need to use `mix ecto.migrate` and manage it separately for each repo, as the options would
|
||||
be applied to both repo, which wouldn't make sense.
|
1
mix.exs
1
mix.exs
|
@ -53,6 +53,7 @@ defmodule AshPostgres.MixProject do
|
|||
logo: "logos/small-logo.png",
|
||||
extras: [
|
||||
"README.md",
|
||||
"documentation/migrations_and_tasks.md",
|
||||
"documentation/multitenancy.md"
|
||||
],
|
||||
groups_for_extras: [
|
||||
|
|
Loading…
Reference in a new issue