-
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.
- Loading branch information
Showing
1 changed file
with
44 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
"""Migration script for dimensions.yaml namespace=daf_butler version=6. | ||
Revision ID: 1fae088c80b6 | ||
Revises: 2a8a32e1bec3 | ||
Create Date: 2024-03-12 14:35:38.888572 | ||
""" | ||
|
||
import logging | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision = "1fae088c80b6" | ||
down_revision = "2a8a32e1bec3" | ||
branch_labels = None | ||
depends_on = None | ||
|
||
# Logger name should start with lsst to work with butler logging option. | ||
_LOG = logging.getLogger(f"lsst.{__name__}") | ||
|
||
|
||
def upgrade() -> None: | ||
"""Perform schema upgrade.""" | ||
_create_group_table() | ||
|
||
|
||
def downgrade() -> None: | ||
"""Perform schema downgrade.""" | ||
raise NotImplementedError() | ||
|
||
|
||
def _create_group_table() -> None: | ||
op.create_table( | ||
"group", | ||
sa.Column("instrument", sa.String(32), primary_key=True), | ||
sa.Column("name", sa.String(64), primary_key=True), | ||
sa.schema.ForeignKeyConstraint( | ||
columns=["instrument"], | ||
refcolumns=["instrument.name"], | ||
name="fkey_group_instrument_name_instrument", | ||
), | ||
) |