- 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:
@@ -386,14 +386,14 @@ class TranslationCache(db.Model):
|
|||||||
last_used_at = db.Column(db.DateTime, nullable=True)
|
last_used_at = db.Column(db.DateTime, nullable=True)
|
||||||
|
|
||||||
|
|
||||||
class PartnerRAGRetriever(db.Model):
|
# class PartnerRAGRetriever(db.Model):
|
||||||
__bind_key__ = 'public'
|
# __bind_key__ = 'public'
|
||||||
__table_args__ = (
|
# __table_args__ = (
|
||||||
db.PrimaryKeyConstraint('tenant_id', 'retriever_id'),
|
# db.PrimaryKeyConstraint('tenant_id', 'retriever_id'),
|
||||||
db.UniqueConstraint('partner_id', 'tenant_id', 'retriever_id'),
|
# db.UniqueConstraint('partner_id', 'tenant_id', 'retriever_id'),
|
||||||
{'schema': 'public'},
|
# {'schema': 'public'},
|
||||||
)
|
# )
|
||||||
|
#
|
||||||
partner_id = db.Column(db.Integer, db.ForeignKey('public.partner.id'), nullable=False)
|
# 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)
|
# tenant_id = db.Column(db.Integer, db.ForeignKey('public.tenant.id'), nullable=False)
|
||||||
retriever_id = db.Column(db.Integer, nullable=False)
|
# retriever_id = db.Column(db.Integer, nullable=False)
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ FROM registry.ask-eve-ai-local.com/josakola/eveai-base:latest
|
|||||||
# Copy the source code into the container.
|
# Copy the source code into the container.
|
||||||
COPY eveai_app /app/eveai_app
|
COPY eveai_app /app/eveai_app
|
||||||
COPY content /app/content
|
COPY content /app/content
|
||||||
|
COPY migrations /app/migrations
|
||||||
|
|||||||
@@ -70,10 +70,12 @@ target_db = current_app.extensions['migrate'].db
|
|||||||
|
|
||||||
def get_public_table_names():
|
def get_public_table_names():
|
||||||
# TODO: This function should include the necessary functionality to automatically retrieve 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',
|
return ['tenant', 'role', 'roles_users', 'user', 'tenant_domain', 'tenant_project', 'tenant_make', 'partner',
|
||||||
'business_event_log', 'tenant_project', 'partner', 'partner_service', 'invoice', 'license_period',
|
'partner_service', 'partner_tenant', 'tenant_consent', 'consent_version', 'specialist_magic_link_tenant',
|
||||||
'license_change_log', 'partner_service_license_tier', 'payment', 'partner_tenant', 'tenant_make',
|
'translation_cache',
|
||||||
'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()
|
PUBLIC_TABLES = get_public_table_names()
|
||||||
logger.info(f"Public tables: {PUBLIC_TABLES}")
|
logger.info(f"Public tables: {PUBLIC_TABLES}")
|
||||||
@@ -147,7 +149,7 @@ def run_migrations_online():
|
|||||||
for tenant in tenants:
|
for tenant in tenants:
|
||||||
try:
|
try:
|
||||||
os.environ['TENANT_ID'] = str(tenant)
|
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
|
# set search path on the connection, which ensures that
|
||||||
# PostgreSQL will emit all CREATE / ALTER / DROP statements
|
# PostgreSQL will emit all CREATE / ALTER / DROP statements
|
||||||
# in terms of this schema by default
|
# in terms of this schema by default
|
||||||
@@ -169,11 +171,13 @@ def run_migrations_online():
|
|||||||
with context.begin_transaction():
|
with context.begin_transaction():
|
||||||
context.run_migrations()
|
context.run_migrations()
|
||||||
|
|
||||||
|
logger.info(f"✅ Migration successfully completed for tenant: {tenant}")
|
||||||
|
|
||||||
# for checking migrate or upgrade is running
|
# for checking migrate or upgrade is running
|
||||||
if getattr(config.cmd_opts, "autogenerate", False):
|
if getattr(config.cmd_opts, "autogenerate", False):
|
||||||
break
|
break
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
continue
|
logger.error(f"🚨 An error occurred during migration: \n{e}")
|
||||||
|
|
||||||
|
|
||||||
if context.is_offline_mode():
|
if context.is_offline_mode():
|
||||||
|
|||||||
Reference in New Issue
Block a user