Total Complexity | 2 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Add provider table |
||
2 | |||
3 | Revision ID: b2a7d7614973 |
||
4 | Revises: 0978347c16f9 |
||
5 | Create Date: 2023-03-22 15:10:27.781804 |
||
6 | |||
7 | """ |
||
8 | |||
9 | from alembic import op |
||
10 | import sqlalchemy as sa |
||
11 | |||
12 | |||
13 | # revision identifiers, used by Alembic. |
||
14 | revision = "b2a7d7614973" |
||
15 | down_revision = "0978347c16f9" |
||
16 | |||
17 | |||
18 | def upgrade(): |
||
19 | op.create_table( |
||
20 | "provider", |
||
21 | sa.Column("id", sa.String(), nullable=False), |
||
22 | sa.Column("conceptscheme_id", sa.Integer(), nullable=False), |
||
23 | sa.Column("uri_pattern", sa.Text(), nullable=False), |
||
24 | sa.Column("metadata", sa.JSON(), nullable=False), |
||
25 | sa.Column( |
||
26 | "expand_strategy", |
||
27 | sa.Enum("RECURSE", "VISIT", name="expandstrategy"), |
||
28 | nullable=True, |
||
29 | ), |
||
30 | sa.ForeignKeyConstraint( |
||
31 | ["conceptscheme_id"], |
||
32 | ["conceptscheme.id"], |
||
33 | ondelete="CASCADE", |
||
34 | ), |
||
35 | sa.PrimaryKeyConstraint("id"), |
||
36 | ) |
||
37 | |||
38 | |||
39 | def downgrade(): |
||
40 | op.drop_table("provider") |
||
41 |