- Temporarily remove PartnerRagRetriever model (as it is not used yet)

- Ensure errors are being logged when migrating tenants
- Ensure migrations directory is copied into eveai_app
This commit is contained in:
Josako
2025-10-23 10:17:57 +02:00
parent 59febb7fbb
commit 2bc5832db6
3 changed files with 22 additions and 17 deletions

View File

@@ -386,14 +386,14 @@ class TranslationCache(db.Model):
last_used_at = db.Column(db.DateTime, nullable=True)
class PartnerRAGRetriever(db.Model):
__bind_key__ = 'public'
__table_args__ = (
db.PrimaryKeyConstraint('tenant_id', 'retriever_id'),
db.UniqueConstraint('partner_id', 'tenant_id', 'retriever_id'),
{'schema': 'public'},
)
partner_id = db.Column(db.Integer, db.ForeignKey('public.partner.id'), nullable=False)
tenant_id = db.Column(db.Integer, db.ForeignKey('public.tenant.id'), nullable=False)
retriever_id = db.Column(db.Integer, nullable=False)
# class PartnerRAGRetriever(db.Model):
# __bind_key__ = 'public'
# __table_args__ = (
# db.PrimaryKeyConstraint('tenant_id', 'retriever_id'),
# db.UniqueConstraint('partner_id', 'tenant_id', 'retriever_id'),
# {'schema': 'public'},
# )
#
# partner_id = db.Column(db.Integer, db.ForeignKey('public.partner.id'), nullable=False)
# tenant_id = db.Column(db.Integer, db.ForeignKey('public.tenant.id'), nullable=False)
# retriever_id = db.Column(db.Integer, nullable=False)

View File

@@ -2,3 +2,4 @@ FROM registry.ask-eve-ai-local.com/josakola/eveai-base:latest
# Copy the source code into the container.
COPY eveai_app /app/eveai_app
COPY content /app/content
COPY migrations /app/migrations

View File

@@ -70,10 +70,12 @@ 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','license_tier', 'license', 'license_usage',
'business_event_log', 'tenant_project', 'partner', 'partner_service', 'invoice', 'license_period',
'license_change_log', 'partner_service_license_tier', 'payment', 'partner_tenant', 'tenant_make',
'specialist_magic_link_tenant', 'translation_cache']
return ['tenant', 'role', 'roles_users', 'user', 'tenant_domain', 'tenant_project', 'tenant_make', 'partner',
'partner_service', 'partner_tenant', 'tenant_consent', 'consent_version', 'specialist_magic_link_tenant',
'translation_cache',
'business_event_log', 'license', 'license_tier', 'partner_service_license_tier', 'license_period',
'license_usage', 'payment', 'invoice', 'license_change_log',
]
PUBLIC_TABLES = get_public_table_names()
logger.info(f"Public tables: {PUBLIC_TABLES}")
@@ -147,7 +149,7 @@ def run_migrations_online():
for tenant in tenants:
try:
os.environ['TENANT_ID'] = str(tenant)
logger.info(f"Migrating tenant: {tenant}")
logger.info(f"🚧 Migrating tenant: {tenant}")
# set search path on the connection, which ensures that
# PostgreSQL will emit all CREATE / ALTER / DROP statements
# in terms of this schema by default
@@ -169,11 +171,13 @@ def run_migrations_online():
with context.begin_transaction():
context.run_migrations()
logger.info(f"✅ Migration successfully completed for tenant: {tenant}")
# for checking migrate or upgrade is running
if getattr(config.cmd_opts, "autogenerate", False):
break
except Exception as e:
continue
logger.error(f"🚨 An error occurred during migration: \n{e}")
if context.is_offline_mode():