40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
|
|
"""namespace claims
|
||
|
|
|
||
|
|
Registry namespace ownership (section 20.1). Descriptive on a filesystem
|
||
|
|
registry, which cannot authenticate a publisher; enforced here, which can —
|
||
|
|
though only as strongly as the identity behind it.
|
||
|
|
|
||
|
|
Revision ID: 0002
|
||
|
|
Revises: 0001
|
||
|
|
"""
|
||
|
|
from alembic import op
|
||
|
|
import sqlalchemy as sa
|
||
|
|
|
||
|
|
BigIntPK = sa.BigInteger().with_variant(sa.Integer, "sqlite")
|
||
|
|
|
||
|
|
revision = '0002'
|
||
|
|
down_revision = '0001'
|
||
|
|
branch_labels = None
|
||
|
|
depends_on = None
|
||
|
|
|
||
|
|
|
||
|
|
def upgrade() -> None:
|
||
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
|
op.create_table('namespace_claims',
|
||
|
|
sa.Column('id', sa.BigInteger().with_variant(sa.Integer(), 'sqlite'), autoincrement=True, nullable=False),
|
||
|
|
sa.Column('tenant', sa.String(length=64), nullable=False),
|
||
|
|
sa.Column('registry', sa.String(length=128), nullable=False),
|
||
|
|
sa.Column('namespace', sa.String(length=256), nullable=False),
|
||
|
|
sa.Column('policy', sa.String(length=16), nullable=False),
|
||
|
|
sa.Column('owner', sa.String(length=256), nullable=True),
|
||
|
|
sa.PrimaryKeyConstraint('id'),
|
||
|
|
sa.UniqueConstraint('tenant', 'registry', 'namespace', name='uq_namespace_claim')
|
||
|
|
)
|
||
|
|
# ### end Alembic commands ###
|
||
|
|
|
||
|
|
|
||
|
|
def downgrade() -> None:
|
||
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
||
|
|
op.drop_table('namespace_claims')
|
||
|
|
# ### end Alembic commands ###
|