-
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 #29 from lsst-dm/tickets/DM-42076
DM-42076: Add script for one-shot collections migration
- Loading branch information
Showing
12 changed files
with
879 additions
and
210 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 was deleted.
Oops, something went wrong.
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,23 +1,40 @@ | ||
<%! | ||
def fmt(item): | ||
if item is None: | ||
return "None" | ||
elif isinstance(item, (list, tuple)): | ||
strings = [fmt(i) for i in item] | ||
return f'({", ".join(strings)},)' | ||
else: | ||
return f'"{item}"' | ||
%>\ | ||
"""${message} | ||
|
||
Revision ID: ${up_revision} | ||
Revises: ${down_revision | comma,n} | ||
Create Date: ${create_date} | ||
|
||
""" | ||
import logging | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
${imports if imports else ""} | ||
# revision identifiers, used by Alembic. | ||
revision = "${up_revision}" | ||
down_revision = "${down_revision}" | ||
branch_labels = ${repr(branch_labels)} | ||
depends_on = ${repr(depends_on)} | ||
revision = ${up_revision | n,fmt} | ||
down_revision = ${down_revision | n,fmt} | ||
branch_labels = ${branch_labels | n,fmt} | ||
depends_on = ${depends_on | n,fmt} | ||
|
||
# Logger name should start with lsst to work with butler logging option. | ||
_LOG = logging.getLogger(f"lsst.{__name__}") | ||
|
||
|
||
def upgrade() -> None: | ||
"""Perform schema upgrade.""" | ||
${upgrades if upgrades else "raise NotImplementedError()"} | ||
|
||
|
||
def downgrade() -> None: | ||
"""Perform schema downgrade.""" | ||
${downgrades if downgrades else "raise NotImplementedError()"} |
Oops, something went wrong.