Skip to content

Commit 114f9fe

Browse files
committed
Installed pre-commits
1 parent ab2f8c2 commit 114f9fe

File tree

7 files changed

+31
-30
lines changed

7 files changed

+31
-30
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ coverage.xml
1212
site
1313
*.db
1414
.cache
15-
!docs_src/**/env.py
15+
!docs_src/**/env.py

docs/advanced/migrations.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ We will start with the **simplest version**, with just heroes (no teams yet).
1111

1212
This is almost the same code as you start to know by heart:
1313

14-
```Python
15-
{!./docs_src/tutorial/migrations/simple_hero_migration/models.py!}
14+
```Python
15+
{!./docs_src/tutorial/migrations/simple_hero_migration/models.py!}
1616
```
1717

1818
Let's jump in your shell and init migrations:
@@ -47,7 +47,7 @@ Let's review what happened: Below files just got created!
4747
├── __init__.py
4848
├── env.py
4949
├── README
50-
├── script.py.mako
50+
├── script.py.mako
5151
└── versions
5252
└── __init__.py
5353
```
@@ -61,17 +61,17 @@ Let's review them step by step.
6161
We need to tell alembic how to connect to the database:
6262

6363
```ini hl_lines="10"
64-
{!./docs_src/tutorial/migrations/simple_hero_migration/alembic001.ini[ln:1-5]!}
64+
{!./docs_src/tutorial/migrations/simple_hero_migration/alembic001.ini[ln:1-5]!}
6565

6666
#.... Lot's of configuration!
6767

6868

6969
{!./docs_src/tutorial/migrations/simple_hero_migration/alembic001.ini[ln:63]!} # 👈 Let's Change that!
7070
```
71-
Adapting our file, you will have:
71+
Adapting our file, you will have:
7272

7373
```ini hl_lines="10"
74-
{!./docs_src/tutorial/migrations/simple_hero_migration/alembic.ini[ln:1-5]!}
74+
{!./docs_src/tutorial/migrations/simple_hero_migration/alembic.ini[ln:1-5]!}
7575

7676
#.... Lot's of configuration!
7777

@@ -85,7 +85,7 @@ For the full document, refer to [Alembic's official documentation](https://alemb
8585
It gives which Tables you want to migrate, let's open it and:
8686

8787
1. Import our models
88-
2. Change `target_metadata` value
88+
2. Change `target_metadata` value
8989

9090
```Python hl_lines="5 7"
9191
{!./docs_src/tutorial/migrations/simple_hero_migration/migrations/001.py[ln:1-5]!} 👈 Import your model
@@ -117,15 +117,15 @@ It created a new file `0610946706a0_.py`
117117

118118
```hl_lines="13"
119119
.
120-
── project
120+
── project
121121
├── __init__.py
122122
├── models.py
123123
├── alembic.ini
124124
└── migrations
125125
├── __init__.py
126126
├── env.py
127127
├── README
128-
├── script.py.mako
128+
├── script.py.mako
129129
└── versions
130130
├── __init__.py
131131
└── 0610946706a0_.py
@@ -141,9 +141,9 @@ Parent: <base>
141141
Path: /path/to/your/project/migrations/versions/0610946706a0_.py #👈 That's our file
142142
143143
empty message
144-
144+
145145
Revision ID: 50624637e300
146-
Revises:
146+
Revises:
147147
Create Date: 2023-10-31 19:40:22.084162
148148
```
149149
</div>
@@ -173,7 +173,7 @@ Why the heck `0610946706a0_.py`?!!!!
173173
The goal is to have a unique revision name to avoid collision.
174174
In order to have a cleaner file name, we can edit `alembic.ini` and uncomment
175175

176-
```ini
176+
```ini
177177
{!./docs_src/tutorial/migrations/simple_hero_migration/alembic.ini[ln:11]!} #👈 Uncoment this line
178178
```
179179

@@ -208,4 +208,4 @@ INFO [alembic.autogenerate.compare] Detected added table 'hero'
208208

209209
You can think of "migrate me iam famous" as a message you add to you migration.
210210

211-
It helps you keep track of what they do, pretty much like in `git`
211+
It helps you keep track of what they do, pretty much like in `git`
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Generic single-database configuration.
2-
I'm the best!
2+
I'm the best!

sqlmodel/cli/migrations/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-

sqlmodel/cli/migrations/cli.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717

1818
@migrations.command()
1919
def init(
20-
module: Path = ".",
21-
config_file: Path = "alembic.ini",
22-
directory: Path = "migrations",
20+
module: Path = Path("."),
21+
config_file: Path = Path("alembic.ini"),
22+
directory: Path = Path("migrations"),
2323
template: str = "generic", # Should be Literal["generic", "multidb", "async"]
2424
target_metadata: Annotated[Optional[str], typer.Argument()] = None,
2525
):
@@ -51,8 +51,8 @@ def init(
5151

5252
@migrations.command()
5353
def revision(
54-
module: Path = ".",
55-
config_file: Path = "alembic.ini",
54+
module: Path = Path("."),
55+
config_file: Path = Path("alembic.ini"),
5656
message: Annotated[Optional[str], typer.Argument()] = None,
5757
autogenerate: bool = True,
5858
sql: bool = False,
@@ -80,16 +80,18 @@ def revision(
8080

8181

8282
@migrations.command()
83-
def show(module: Path = ".", config_file: Path = "alembic.ini", rev: str = "head"):
83+
def show(
84+
module: Path = Path("."), config_file: Path = Path("alembic.ini"), rev: str = "head"
85+
):
8486
"""Show the revision"""
8587
config = Config(module / config_file)
8688
command.show(config, rev)
8789

8890

8991
def merge(
9092
revisions: List[str],
91-
module: Path = ".",
92-
config_file: Path = "alembic.ini",
93+
module: Path = Path("."),
94+
config_file: Path = Path("alembic.ini"),
9395
message: Annotated[Optional[str], typer.Argument()] = None,
9496
branch_label: Annotated[Optional[List[str]], typer.Argument()] = None,
9597
rev_id: Annotated[Optional[str], typer.Argument()] = None,
@@ -108,8 +110,8 @@ def merge(
108110
@migrations.command()
109111
def upgrade(
110112
revision: str = "head",
111-
module: Path = ".",
112-
config_file: Path = "alembic.ini",
113+
module: Path = Path("."),
114+
config_file: Path = Path("alembic.ini"),
113115
sql: bool = False,
114116
tag: Annotated[Optional[str], typer.Argument()] = None,
115117
):
@@ -121,8 +123,8 @@ def upgrade(
121123
@migrations.command()
122124
def downgrade(
123125
revision: str = "head",
124-
module: Path = ".",
125-
config_file: Path = "alembic.ini",
126+
module: Path = Path("."),
127+
config_file: Path = Path("alembic.ini"),
126128
sql: bool = False,
127129
tag: Annotated[Optional[str], typer.Argument()] = None,
128130
):
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Generic single-database configuration with an async dbapi.
1+
Generic single-database configuration with an async dbapi.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
Generic single-database configuration.
2-
I'm the best!
2+
I'm the best!

0 commit comments

Comments
 (0)