-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
A package originates from - or is created on behalf of - a data provider, and should only be linked with a record associated (via collection) with that same provider.
- Loading branch information
1 parent
6704684
commit 0b08dba
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
migrate/versions/2023_11_23_1eea59d91fea_link_package_to_provider.py
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,30 @@ | ||
"""Link package to provider | ||
Revision ID: 1eea59d91fea | ||
Revises: 220060b4adb3 | ||
Create Date: 2023-11-23 14:48:06.777908 | ||
""" | ||
from alembic import op | ||
import sqlalchemy as sa | ||
|
||
|
||
# revision identifiers, used by Alembic. | ||
revision = '1eea59d91fea' | ||
down_revision = '220060b4adb3' | ||
branch_labels = None | ||
depends_on = None | ||
|
||
|
||
def upgrade(): | ||
# ### commands auto generated by Alembic - adjusted ### | ||
op.add_column('package', sa.Column('provider_id', sa.String(), nullable=False)) | ||
op.create_foreign_key('package_provider_id_fkey', 'package', 'provider', ['provider_id'], ['id'], ondelete='CASCADE') | ||
# ### end Alembic commands ### | ||
|
||
|
||
def downgrade(): | ||
# ### commands auto generated by Alembic - adjusted ### | ||
op.drop_constraint('package_provider_id_fkey', 'package', type_='foreignkey') | ||
op.drop_column('package', 'provider_id') | ||
# ### end Alembic commands ### |
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