updated schema for deletion by timestamp (equivalent to other parts of the app)

This commit is contained in:
2026-07-15 17:08:06 +02:00
parent af62025558
commit f4a4d2d98e
3 changed files with 54 additions and 0 deletions
@@ -0,0 +1,42 @@
"""timestamps for deletions of initial recording
Revision ID: 85577ce9f2ab
Revises: 830416cab29c
Create Date: 2026-07-15 17:06:55.947134
"""
from typing import Sequence, Union
import sqlalchemy as sa
from alembic import op
import wce_crm.db
# revision identifiers, used by Alembic.
revision: str = "85577ce9f2ab"
down_revision: Union[str, Sequence[str], None] = "830416cab29c"
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(
"grunderfassung_personen",
sa.Column("geloescht", wce_crm.db.UTCDateTime(), nullable=True),
)
op.add_column(
"grunderfassung_unternehmen",
sa.Column("geloescht", wce_crm.db.UTCDateTime(), nullable=True),
)
# ### end Alembic commands ###
def downgrade() -> None:
"""Downgrade schema."""
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column("grunderfassung_unternehmen", "geloescht")
op.drop_column("grunderfassung_personen", "geloescht")
# ### end Alembic commands ###
+2
View File
@@ -9,6 +9,7 @@ Ext_CRM.Ansprechpartner
Grunderfassung_Unternehmen Grunderfassung_Unternehmen
un_id int pk {autoIncrement} un_id int pk {autoIncrement}
geloescht "timestamp with time zone" nullable
Metadaten_erstellung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable Metadaten_erstellung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable
Metadaten_aktualisierung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable {on_update: `datetime.datetime.now(datetime.UTC)`} Metadaten_aktualisierung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable {on_update: `datetime.datetime.now(datetime.UTC)`}
Metadaten_nutzer varchar(20) nullable Metadaten_nutzer varchar(20) nullable
@@ -21,6 +22,7 @@ Grunderfassung_Unternehmen
Grunderfassung_Personen Grunderfassung_Personen
pers_id int pk {autoIncrement} pers_id int pk {autoIncrement}
geloescht "timestamp with time zone" nullable
Metadaten_erstellung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable Metadaten_erstellung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable
Metadaten_aktualisierung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable {on_update: `datetime.datetime.now(datetime.UTC)`} Metadaten_aktualisierung "timestamp with time zone"=`datetime.datetime.now(datetime.UTC)` nullable {on_update: `datetime.datetime.now(datetime.UTC)`}
Metadaten_wiedereintrittsdatum timestamp nullable Metadaten_wiedereintrittsdatum timestamp nullable
+10
View File
@@ -256,6 +256,11 @@ grunderfassung_unternehmen: sql.Table = Table(
primary_key=True, primary_key=True,
autoincrement=True, autoincrement=True,
), ),
Column(
"geloescht",
UTCDateTime,
nullable=True,
),
Column( Column(
"Metadaten_erstellung", "Metadaten_erstellung",
UTCDateTime, UTCDateTime,
@@ -286,6 +291,11 @@ grunderfassung_personen: sql.Table = Table(
primary_key=True, primary_key=True,
autoincrement=True, autoincrement=True,
), ),
Column(
"geloescht",
UTCDateTime,
nullable=True,
),
Column( Column(
"Metadaten_erstellung", "Metadaten_erstellung",
UTCDateTime, UTCDateTime,