feat: applied model mixins
IdMixin used on every table with an ID index (no changes needed to db) Timestamp and Deleted mixins applied to org and user tables. ActivatedMixin added to users.
This commit is contained in:
parent
7e1ab6c6ee
commit
c28b4dc37b
6 changed files with 60 additions and 15 deletions
44
alembic/versions/2026-06-22_model_mixins.py
Normal file
44
alembic/versions/2026-06-22_model_mixins.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
"""model mixins
|
||||
|
||||
Revision ID: 661202797ecd
|
||||
Revises: 869d48618a1c
|
||||
Create Date: 2026-06-22 13:29:39.689067
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = '661202797ecd'
|
||||
down_revision: Union[str, Sequence[str], None] = '869d48618a1c'
|
||||
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('organisation', sa.Column('created_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()))
|
||||
op.add_column('organisation', sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()))
|
||||
op.add_column('organisation', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True))
|
||||
op.add_column('user', sa.Column('active', sa.Boolean(), nullable=False, server_default=sa.false()))
|
||||
op.add_column('user', sa.Column('created_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()))
|
||||
op.add_column('user', sa.Column('updated_at', sa.DateTime(timezone=True), nullable=False, server_default=sa.func.now()))
|
||||
op.add_column('user', sa.Column('deleted_at', sa.DateTime(timezone=True), nullable=True))
|
||||
# ### end Alembic commands ###
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
"""Downgrade schema."""
|
||||
# ### commands auto generated by Alembic - please adjust! ###
|
||||
op.drop_column('user', 'deleted_at')
|
||||
op.drop_column('user', 'updated_at')
|
||||
op.drop_column('user', 'created_at')
|
||||
op.drop_column('user', 'active')
|
||||
op.drop_column('organisation', 'deleted_at')
|
||||
op.drop_column('organisation', 'updated_at')
|
||||
op.drop_column('organisation', 'created_at')
|
||||
# ### end Alembic commands ###
|
||||
Loading…
Add table
Add a link
Reference in a new issue