mirror of
https://github.com/reconurge/flowsint.git
synced 2026-05-02 04:09:32 -05:00
46 lines
1.6 KiB
Python
46 lines
1.6 KiB
Python
"""add_third_party_keys_table
|
|
|
|
Revision ID: e403a4152f6b
|
|
Revises: 6dfa83113ad7
|
|
Create Date: 2025-06-22 22:43:43.440473
|
|
|
|
"""
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = 'e403a4152f6b'
|
|
down_revision: Union[str, None] = '6dfa83113ad7'
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
"""Upgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.create_table('third_party_keys',
|
|
sa.Column('id', sa.UUID(), nullable=False),
|
|
sa.Column('service', sa.String(), nullable=False),
|
|
sa.Column('owner_id', sa.UUID(), nullable=True),
|
|
sa.Column('encrypted_key', sa.String(), nullable=False),
|
|
sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text('now()'), nullable=True),
|
|
sa.ForeignKeyConstraint(['owner_id'], ['profiles.id'], onupdate='CASCADE', ondelete='CASCADE'),
|
|
sa.PrimaryKeyConstraint('id'),
|
|
if_not_exists=True
|
|
)
|
|
op.create_index('idx_keys_owner_id', 'third_party_keys', ['owner_id'], unique=False)
|
|
op.create_index('idx_keys_service', 'third_party_keys', ['service'], unique=False)
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade() -> None:
|
|
"""Downgrade schema."""
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
op.drop_index('idx_keys_service', table_name='third_party_keys')
|
|
op.drop_index('idx_keys_owner_id', table_name='third_party_keys')
|
|
op.drop_table('third_party_keys')
|
|
# ### end Alembic commands ###
|