-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from pmdevita/master
Release 0.5.1
- Loading branch information
Showing
11 changed files
with
715 additions
and
821 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,69 @@ | ||
# Migrations | ||
|
||
## Formatting Migrations | ||
Atsume integrates [Alembic](https://alembic.sqlalchemy.org/en/latest/index.html) | ||
for performing semi-automatic database migrations. A migration is a | ||
database operation that takes us from a previous definition of the | ||
models to the current. | ||
|
||
Migrations are automatically formatted if you have the `black` package installed. You can do | ||
:::warning | ||
Atsume's migrations are still under heavy development! While | ||
it can handle many simple tasks fine, it may not always catch | ||
more complicated model modifications. It's a good idea to always | ||
double-check the generated migration files before running them. | ||
::: | ||
|
||
## Limitations | ||
|
||
Atsume's automatic generation of migrations largely shares the same list of | ||
limitations as Alembic. This notably includes: | ||
|
||
- Changes to table, column, or constraint name | ||
- Change of a column's `server_default` | ||
|
||
To create migrations for these changes, they must be created manually, which is covered later. | ||
|
||
Extending Alembic to add support for automatically generating these changes is | ||
on the roadmap. | ||
|
||
## Commands | ||
|
||
### Making Migrations | ||
|
||
Migrations can be created with the `makemigrations` command. | ||
|
||
```shell | ||
python manage.py makemigrations | ||
``` | ||
|
||
This will make new migrations for any changes in any currently loaded apps. | ||
|
||
You can also specify to limit to just a single app. | ||
|
||
```shell | ||
python manage.py makemigrations -c my_component | ||
``` | ||
|
||
### Upgrading and downgrading migrations | ||
|
||
You can apply all generated migrations with the `upgrade` command. | ||
|
||
```shell | ||
python manage.py upgrade | ||
``` | ||
|
||
You can also specify a specific app or revision number to upgrade to. | ||
|
||
```shell | ||
python manage.py upgrade my_component | ||
``` | ||
|
||
|
||
## Auto-formatting Migrations | ||
|
||
Migrations are automatically formatted if you have the `black` package installed. | ||
|
||
```shell | ||
pip install black | ||
``` | ||
|
||
to enable it. | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,5 +11,6 @@ tutorial_1 | |
tutorial_2 | ||
tutorial_3 | ||
tutorial_4 | ||
tutorial_5 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Database Migrations | ||
|
||
Database migrations are operations that help us transition from a previous | ||
state of the database to a new one. In Atsume, migrations can be automatically | ||
generated as you create and update your database models. | ||
|
||
## Adding a foreign key and inspecting the migration | ||
|
||
## Renaming a field | ||
|
||
## Downgrading |
Oops, something went wrong.