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.
This commit is contained in:
parent
707482adc2
commit
2b6d923ae1
7 changed files with 146 additions and 165 deletions
34
.alembic/versions/2026-05-25_contact_model_changes.py
Normal file
34
.alembic/versions/2026-05-25_contact_model_changes.py
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
"""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 ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue