mirror of
https://github.com/creyD/apilog.git
synced 2026-04-12 11:20:29 +02:00
feat: added retention_days for compliance
This commit is contained in:
29
alembic/versions/1e695b024786_.py
Normal file
29
alembic/versions/1e695b024786_.py
Normal file
@@ -0,0 +1,29 @@
|
||||
"""empty message
|
||||
|
||||
Revision ID: 1e695b024786
|
||||
Revises: 21dc1dc045b8
|
||||
Create Date: 2025-01-20 11:36:14.692849
|
||||
|
||||
"""
|
||||
|
||||
from typing import Sequence, Union
|
||||
|
||||
import sqlalchemy as sa
|
||||
|
||||
from alembic import op
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision: str = "1e695b024786"
|
||||
down_revision: Union[str, None] = "21dc1dc045b8"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
with op.batch_alter_table("application", schema=None) as batch_op:
|
||||
batch_op.add_column(sa.Column("retention_days", sa.Integer(), nullable=True))
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
with op.batch_alter_table("application", schema=None) as batch_op:
|
||||
batch_op.drop_column("retention_days")
|
||||
@@ -1,6 +1,7 @@
|
||||
from creyPY.fastapi.models.base import Base
|
||||
from sqlalchemy import Column, String
|
||||
from sqlalchemy import Column, Integer, String
|
||||
|
||||
|
||||
class Application(Base):
|
||||
name = Column(String(512), nullable=False, unique=True)
|
||||
retention_days = Column(Integer, nullable=True, default=30)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
from creyPY.fastapi.models.base import Base
|
||||
from sqlalchemy import Column, String, ForeignKey, Enum, JSON
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
from enum import Enum as pyenum
|
||||
|
||||
from creyPY.fastapi.models.base import Base
|
||||
from sqlalchemy import JSON, Column, Enum, ForeignKey, String
|
||||
from sqlalchemy.dialects.postgresql import UUID
|
||||
|
||||
|
||||
class TransactionType(pyenum):
|
||||
CREATE = "create"
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
from pydantic.json_schema import SkipJsonSchema
|
||||
|
||||
from app.schema.common import BaseSchemaModelIN, BaseSchemaModelOUT
|
||||
|
||||
|
||||
class AppIN(BaseSchemaModelIN):
|
||||
name: str
|
||||
retention_days: int | SkipJsonSchema[None] = 30
|
||||
|
||||
|
||||
class AppOUT(BaseSchemaModelOUT, AppIN):
|
||||
|
||||
Reference in New Issue
Block a user