- Minor corrections to entitlement changes and upgrades

- started new eveai_entitlements component (not finished)
This commit is contained in:
Josako
2024-10-08 09:12:16 +02:00
parent 9782e31ae5
commit d6a7743f26
12 changed files with 392 additions and 13 deletions

View File

@@ -0,0 +1,56 @@
"""LicenseUsage and Tenant updates
Revision ID: 8fdd7f2965c1
Revises: 6a7743d08106
Create Date: 2024-10-08 06:33:50.297396
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '8fdd7f2965c1'
down_revision = '6a7743d08106'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('business_event_log', schema=None) as batch_op:
batch_op.add_column(sa.Column('document_version_file_size', sa.Float(), nullable=True))
with op.batch_alter_table('license_usage', schema=None) as batch_op:
batch_op.add_column(sa.Column('embedding_prompt_tokens_used', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('embedding_completion_tokens_used', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('embedding_total_tokens_used', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('interaction_prompt_tokens_used', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('interaction_completion_tokens_used', sa.Integer(), nullable=True))
batch_op.add_column(sa.Column('interaction_total_tokens_used', sa.Integer(), nullable=True))
batch_op.drop_column('interaction_tokens_used')
with op.batch_alter_table('tenant', schema=None) as batch_op:
batch_op.add_column(sa.Column('storage_dirty', sa.Boolean(), nullable=True))
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
with op.batch_alter_table('tenant', schema=None) as batch_op:
batch_op.drop_column('storage_dirty')
with op.batch_alter_table('license_usage', schema=None) as batch_op:
batch_op.add_column(sa.Column('interaction_tokens_used', sa.INTEGER(), autoincrement=False, nullable=True))
batch_op.drop_column('interaction_total_tokens_used')
batch_op.drop_column('interaction_completion_tokens_used')
batch_op.drop_column('interaction_prompt_tokens_used')
batch_op.drop_column('embedding_total_tokens_used')
batch_op.drop_column('embedding_completion_tokens_used')
batch_op.drop_column('embedding_prompt_tokens_used')
with op.batch_alter_table('business_event_log', schema=None) as batch_op:
batch_op.drop_column('document_version_file_size')
# ### end Alembic commands ###

View File

@@ -50,7 +50,8 @@ target_db = current_app.extensions['migrate'].db
def get_public_table_names():
# TODO: This function should include the necessary functionality to automatically retrieve table names
return ['role', 'roles_users', 'tenant', 'user', 'tenant_domain']
return ['role', 'roles_users', 'tenant', 'user', 'tenant_domain','license_tier', 'license', 'license_usage',
'business_event_log']
PUBLIC_TABLES = get_public_table_names()

View File

@@ -0,0 +1,31 @@
"""Remove obsolete fields from DocumentVersion
Revision ID: 5a75fb6da7b8
Revises: 322d3cf1f17b
Create Date: 2024-10-08 06:49:57.349346
"""
from alembic import op
import sqlalchemy as sa
import pgvector
# revision identifiers, used by Alembic.
revision = '5a75fb6da7b8'
down_revision = '322d3cf1f17b'
branch_labels = None
depends_on = None
def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_column('document_version', 'file_name')
op.drop_column('document_version', 'file_location')
# ### end Alembic commands ###
def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.add_column('document_version', sa.Column('file_location', sa.VARCHAR(length=255), autoincrement=False, nullable=True))
op.add_column('document_version', sa.Column('file_name', sa.VARCHAR(length=200), autoincrement=False, nullable=True))
# ### end Alembic commands ###