Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
🎨 update: add spacing for clarity in migration documentation
  • Loading branch information
ezeparziale committed Sep 7, 2025
commit 9b58d73ac67c22272543ad248dc51839ea6590b5
8 changes: 8 additions & 0 deletions docs/advanced/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Then go to `migrations\env.py` to finish the alembic configuration.
```

/// warning

First import your models and then import SQLModel otherwise sqlmodel doesn´t recognize all models.

///
Expand All @@ -137,7 +138,9 @@ Then go to `migrations\env.py` to finish the alembic configuration.
```

/// tip

This step can be replaced setting the same `sqlalchemy.url` variable in `alembic.ini` file.

///

- Finally set `target_metadata` with your `SQLModel.metada`
Expand Down Expand Up @@ -179,6 +182,7 @@ Generating migrations\versions\34abfb7ac266_init_db.py ... done
Now in `versions` folder we have a new file called `34abfb7ac266_init_db.py`

/// info

This file has a revision id and the message part from our revision command.

///
Expand All @@ -190,6 +194,7 @@ Now in `versions` folder we have a new file called `34abfb7ac266_init_db.py`
{!./docs_src/advanced/migrations/annotations/en/tutorial005.md!}

/// success

At this moment we have all the files to create our new database model.

///
Expand Down Expand Up @@ -295,6 +300,7 @@ The new file `b39b8d3c77f0_new_field_power.py`:
{!./docs_src/advanced/migrations/annotations/en/tutorial007.md!}

/// note

Run `alembic upgrade head` to add the new field named power

///
Expand All @@ -312,6 +318,7 @@ INFO [alembic.runtime.migration] Running upgrade 357d6ebcfadf -> b39b8d3c77f0,
</div>

/// note

After you can downgrade the database to the previous version, run `alembic downgrade -1`

///
Expand All @@ -329,6 +336,7 @@ INFO [alembic.runtime.migration] Running downgrade b39b8d3c77f0 -> 357d6ebcfadf
</div>

/// success

Migrations complete!!! Try adding new tables and relationship.

///