cloud-api/.alembic/versions/2026-05-25_contact_model_changes.py
luxferre 2b6d923ae1 feat: contact model restructure
Blank contacts are now generated on org creation and assigned to each contact type. These contacts are linked to the org, only accessible to the org, and removed when the org is removed.

With this all contact endpoints have been removed. Contact manipulation is done via the org only.
2026-05-25 15:15:50 +01:00

34 lines
1 KiB
Python

"""Contact model changes
Revision ID: 8132c4b88665
Revises: a147965e644e
Create Date: 2026-05-25 13:09:22.635058
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = '8132c4b88665'
down_revision: Union[str, Sequence[str], None] = 'a147965e644e'
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.add_column('contact', sa.Column('org_id', sa.Integer(), nullable=False))
op.create_foreign_key(None, 'contact', 'organisation', ['org_id'], ['id'], ondelete='CASCADE')
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'contact', type_='foreignkey')
op.drop_column('contact', 'org_id')
# ### end Alembic commands ###