Skip to content

Commit

Permalink
add real name in comment in migrations (#247)
Browse files Browse the repository at this point in the history
Changes:

- add real database name / url as comment when mangling the database
  name/url
  • Loading branch information
devkral authored Dec 16, 2024
1 parent bdaca26 commit ead9da0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions edgy/cli/templates/default/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,14 @@ def downgrade(engine_name: str = "") -> None:
% for db_name in db_names:

def ${f"upgrade_{hash_to_identifier(db_name or '')}"}():
# Migration of:
# ${db_name or 'main database'}
${context.get(f"{db_name or ''}_upgrades", "pass")}


def ${f"downgrade_{hash_to_identifier(db_name or '')}"}():
# Migration of:
# ${db_name or 'main database'}
${context.get(f"{db_name or ''}_downgrades", "pass")}

% endfor
4 changes: 4 additions & 0 deletions edgy/cli/templates/url/script.py.mako
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,14 @@ def downgrade(url: Optional["DatabaseURL"] = None) -> None:
% for db_name in db_names:

def ${f"upgrade_{hash_to_identifier(url_for_name(db_name))}"}():
# Migration of:
# ${url_for_name(db_name)} (${db_name or 'main database'})
${context.get(f"{db_name or ''}_upgrades", "pass")}


def ${f"downgrade_{hash_to_identifier(url_for_name(db_name))}"}():
# Migration of:
# ${url_for_name(db_name)} (${db_name or 'main database'})
${context.get(f"{db_name or ''}_downgrades", "pass")}

% endfor

0 comments on commit ead9da0

Please sign in to comment.