From bbe805557367e86a518cad295632b9c1a9aff0e3 Mon Sep 17 00:00:00 2001 From: Ryan Westfall Date: Mon, 27 Jul 2026 07:12:45 -0500 Subject: [PATCH] Fix migration conflict with password-reset leaves Renumber OAuthIdentity to 0026 after 0025_outbound_email (master already shipped 0024_user_auth_event), and restore missing ResetUserPassword import. --- .../migrations/0024_oauthidentity.py | 37 --------- .../migrations/0026_oauthidentity.py | 75 +++++++++++++++++++ llm_be/chat_backend/urls.py | 1 + 3 files changed, 76 insertions(+), 37 deletions(-) delete mode 100644 llm_be/chat_backend/migrations/0024_oauthidentity.py create mode 100644 llm_be/chat_backend/migrations/0026_oauthidentity.py diff --git a/llm_be/chat_backend/migrations/0024_oauthidentity.py b/llm_be/chat_backend/migrations/0024_oauthidentity.py deleted file mode 100644 index 539e82c..0000000 --- a/llm_be/chat_backend/migrations/0024_oauthidentity.py +++ /dev/null @@ -1,37 +0,0 @@ -# Generated by Django 6.0 on 2026-07-27 11:51 - -import django.db.models.deletion -import django.utils.timezone -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('chat_backend', '0023_promptmetric_tokens_in_promptmetric_tokens_out'), - ] - - operations = [ - migrations.CreateModel( - name='OAuthIdentity', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('created', models.DateTimeField(default=django.utils.timezone.now)), - ('last_modified', models.DateTimeField(default=django.utils.timezone.now)), - ('provider', models.CharField(choices=[('google', 'Google'), ('microsoft', 'Microsoft')], max_length=32)), - ('subject', models.CharField(help_text='OIDC subject (sub) from the identity provider', max_length=255)), - ('email', models.EmailField(blank=True, default='', max_length=254)), - ('access_token', models.TextField(blank=True, default='')), - ('refresh_token', models.TextField(blank=True, default='')), - ('token_expires_at', models.DateTimeField(blank=True, null=True)), - ('scopes', models.TextField(blank=True, default='')), - ('raw_profile', models.JSONField(blank=True, default=dict)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oauth_identities', to=settings.AUTH_USER_MODEL)), - ], - options={ - 'verbose_name_plural': 'OAuth identities', - 'constraints': [models.UniqueConstraint(fields=('provider', 'subject'), name='uniq_oauth_provider_subject'), models.UniqueConstraint(fields=('provider', 'user'), name='uniq_oauth_provider_user')], - }, - ), - ] diff --git a/llm_be/chat_backend/migrations/0026_oauthidentity.py b/llm_be/chat_backend/migrations/0026_oauthidentity.py new file mode 100644 index 0000000..4321e11 --- /dev/null +++ b/llm_be/chat_backend/migrations/0026_oauthidentity.py @@ -0,0 +1,75 @@ +# Generated by Django 6.0 on 2026-07-27 11:51 + +import django.db.models.deletion +import django.utils.timezone +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("chat_backend", "0025_outbound_email"), + ] + + operations = [ + migrations.CreateModel( + name="OAuthIdentity", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ("created", models.DateTimeField(default=django.utils.timezone.now)), + ( + "last_modified", + models.DateTimeField(default=django.utils.timezone.now), + ), + ( + "provider", + models.CharField( + choices=[("google", "Google"), ("microsoft", "Microsoft")], + max_length=32, + ), + ), + ( + "subject", + models.CharField( + help_text="OIDC subject (sub) from the identity provider", + max_length=255, + ), + ), + ("email", models.EmailField(blank=True, default="", max_length=254)), + ("access_token", models.TextField(blank=True, default="")), + ("refresh_token", models.TextField(blank=True, default="")), + ("token_expires_at", models.DateTimeField(blank=True, null=True)), + ("scopes", models.TextField(blank=True, default="")), + ("raw_profile", models.JSONField(blank=True, default=dict)), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="oauth_identities", + to=settings.AUTH_USER_MODEL, + ), + ), + ], + options={ + "verbose_name_plural": "OAuth identities", + "constraints": [ + models.UniqueConstraint( + fields=("provider", "subject"), + name="uniq_oauth_provider_subject", + ), + models.UniqueConstraint( + fields=("provider", "user"), name="uniq_oauth_provider_user" + ), + ], + }, + ), + ] diff --git a/llm_be/chat_backend/urls.py b/llm_be/chat_backend/urls.py index 7672d0c..1ad339e 100644 --- a/llm_be/chat_backend/urls.py +++ b/llm_be/chat_backend/urls.py @@ -15,6 +15,7 @@ from .views import ( ConversationDetailView, CompanyUsersView, SetUserPassword, + ResetUserPassword, ConversationPreferences, UserPromptAnalytics, UserConversationAnalytics,