Merge branch 'bugfix/Improve_and_Correct_Migration_Process' into develop
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"dist/chat-client.js": "dist/chat-client.59b28883.js",
|
||||
"dist/chat-client.css": "dist/chat-client.79757200.css",
|
||||
"dist/chat-client.js": "dist/chat-client.8fea5d6b.js",
|
||||
"dist/chat-client.css": "dist/chat-client.22ac21c3.css",
|
||||
"dist/main.js": "dist/main.c5b0c81d.js",
|
||||
"dist/main.css": "dist/main.06893f70.css"
|
||||
}
|
||||
@@ -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
|
||||
|
||||
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user