Skip to content

Commit 5a1018e

Browse files
committed
putting the piccolo version in the migration file
1 parent a3077b1 commit 5a1018e

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

piccolo/apps/migrations/commands/new.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import jinja2
1010

1111
from .base import BaseMigrationManager
12+
from piccolo import __VERSION__
1213
from piccolo.conf.apps import AppConfig, AppRegistry
1314
from piccolo.apps.migrations.auto import (
1415
SchemaSnapshot,
@@ -32,7 +33,7 @@
3233

3334
def render_template(**kwargs):
3435
template = JINJA_ENV.get_template("migration.py.jinja")
35-
return template.render(**kwargs)
36+
return template.render(version=__VERSION__, **kwargs)
3637

3738

3839
def _create_migrations_folder(migrations_path: str) -> bool:

piccolo/apps/migrations/commands/templates/migration.py.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ from piccolo.apps.migrations.auto import MigrationManager
22

33

44
ID = '{{ migration_id }}'
5+
VERSION = '{{ version }}'
56

67

78
async def forwards():

0 commit comments

Comments
 (0)