mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 21:29:11 +00:00
* Update the conversation_id primary key field to be a uuid - update associated API endpoints - this is to improve the overall application health, by obfuscating some information about the internal database - conversation_id type is now implicitly a string, rather than an int - ensure automations are also migrated in place, such that the conversation_ids they're pointing to are now mapped to the new IDs * Update client-side API calls to correctly query with a string field * Allow modifying of conversation properties from the chat title * Improve drag and drop file experience for chat input area * Use a phosphor icon for the copy to clipboard experience for code snippets * Update conversation_id parameter to be a str type * If django_apscheduler is not in the environment, skip the migration script * Fix create automation flow by storing conversation id as string The new UUID used for conversation id can't be directly serialized. Convert to string for serializing it for later execution --------- Co-authored-by: Debanjum Singh Solanky <debanjum@gmail.com>
37 lines
964 B
Python
37 lines
964 B
Python
# Generated by Django 5.0.8 on 2024-09-19 15:53
|
|
|
|
import uuid
|
|
|
|
from django.db import migrations, models
|
|
|
|
|
|
def create_uuid(apps, schema_editor):
|
|
Conversation = apps.get_model("database", "Conversation")
|
|
for conversation in Conversation.objects.all():
|
|
conversation.temp_id = uuid.uuid4()
|
|
conversation.save()
|
|
|
|
|
|
def remove_uuid(apps, schema_editor):
|
|
pass
|
|
|
|
|
|
class Migration(migrations.Migration):
|
|
dependencies = [
|
|
("database", "0062_merge_20240913_0222"),
|
|
]
|
|
|
|
operations = [
|
|
migrations.AddField(
|
|
model_name="conversation",
|
|
name="temp_id",
|
|
field=models.UUIDField(default=uuid.uuid4, editable=False),
|
|
),
|
|
migrations.RunPython(create_uuid, reverse_code=remove_uuid),
|
|
migrations.AlterField(
|
|
model_name="conversation",
|
|
name="temp_id",
|
|
field=models.UUIDField(default=uuid.uuid4, editable=False, unique=True),
|
|
),
|
|
]
|