added usage limit visuals and DB

This commit is contained in:
2025-06-05 11:40:52 +02:00
parent 97fde3388b
commit a78f3c0786
9 changed files with 212 additions and 66 deletions

View File

@@ -0,0 +1,36 @@
"""add docupulse settings table
Revision ID: add_docupulse_settings
Revises: add_notifs_table
Create Date: 2024-03-19 10:00:00.000000
"""
from alembic import op
import sqlalchemy as sa
from datetime import datetime
# revision identifiers, used by Alembic.
revision = 'add_docupulse_settings'
down_revision = 'add_notifs_table'
branch_labels = None
depends_on = None
def upgrade():
# Create docupulse_settings table
op.create_table('docupulse_settings',
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('max_rooms', sa.Integer(), nullable=False, server_default='10'),
sa.Column('max_conversations', sa.Integer(), nullable=False, server_default='10'),
sa.Column('max_storage', sa.Integer(), nullable=False, server_default='10737418240'), # 10GB in bytes
sa.Column('updated_at', sa.DateTime(), nullable=False, server_default=sa.text('CURRENT_TIMESTAMP')),
sa.PrimaryKeyConstraint('id')
)
# Insert default settings
op.execute("""
INSERT INTO docupulse_settings (id, max_rooms, max_conversations, max_storage, updated_at)
VALUES (1, 10, 10, 10737418240, CURRENT_TIMESTAMP)
""")
def downgrade():
op.drop_table('docupulse_settings')