diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0001_initial.py b/rest_framework_simplejwt/token_blacklist/migrations/0001_initial.py index 88baa7d93..1d48c2e83 100644 --- a/rest_framework_simplejwt/token_blacklist/migrations/0001_initial.py +++ b/rest_framework_simplejwt/token_blacklist/migrations/0001_initial.py @@ -1,3 +1,5 @@ +# Generated by Django 5.0.2 on 2024-02-08 19:04 + import django.db.models.deletion from django.conf import settings from django.db import migrations, models @@ -11,55 +13,44 @@ class Migration(migrations.Migration): ] operations = [ - migrations.CreateModel( - name="BlacklistedToken", - fields=[ - ( - "id", - models.AutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("blacklisted_at", models.DateTimeField(auto_now_add=True)), - ], - ), migrations.CreateModel( name="OutstandingToken", fields=[ - ( - "id", - models.AutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ), - ("jti", models.UUIDField(unique=True)), + ("id", models.BigAutoField(primary_key=True, serialize=False)), + ("jti", models.CharField(max_length=255, unique=True)), ("token", models.TextField()), - ("created_at", models.DateTimeField()), + ("created_at", models.DateTimeField(blank=True, null=True)), ("expires_at", models.DateTimeField()), ( "user", models.ForeignKey( - on_delete=django.db.models.deletion.CASCADE, + blank=True, + null=True, + on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, ), ), ], options={ "ordering": ("user",), + "abstract": False, }, ), - migrations.AddField( - model_name="blacklistedtoken", - name="token", - field=models.OneToOneField( - on_delete=django.db.models.deletion.CASCADE, - to="token_blacklist.OutstandingToken", - ), + migrations.CreateModel( + name="BlacklistedToken", + fields=[ + ("id", models.BigAutoField(primary_key=True, serialize=False)), + ("blacklisted_at", models.DateTimeField(auto_now_add=True)), + ( + "token", + models.OneToOneField( + on_delete=django.db.models.deletion.CASCADE, + to="token_blacklist.outstandingtoken", + ), + ), + ], + options={ + "abstract": False, + }, ), ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0002_outstandingtoken_jti_hex.py b/rest_framework_simplejwt/token_blacklist/migrations/0002_outstandingtoken_jti_hex.py deleted file mode 100644 index 59af197e6..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0002_outstandingtoken_jti_hex.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0001_initial"), - ] - - operations = [ - migrations.AddField( - model_name="outstandingtoken", - name="jti_hex", - field=models.CharField(blank=True, null=True, max_length=255), - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0003_auto_20171017_2007.py b/rest_framework_simplejwt/token_blacklist/migrations/0003_auto_20171017_2007.py deleted file mode 100644 index 1b753499a..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0003_auto_20171017_2007.py +++ /dev/null @@ -1,31 +0,0 @@ -from uuid import UUID - -from django.db import migrations - - -def populate_jti_hex(apps, schema_editor): - OutstandingToken = apps.get_model("token_blacklist", "OutstandingToken") - - db_alias = schema_editor.connection.alias - for token in OutstandingToken.objects.using(db_alias).all(): - token.jti_hex = token.jti.hex - token.save() - - -def reverse_populate_jti_hex(apps, schema_editor): # pragma: no cover - OutstandingToken = apps.get_model("token_blacklist", "OutstandingToken") - - db_alias = schema_editor.connection.alias - for token in OutstandingToken.objects.using(db_alias).all(): - token.jti = UUID(hex=token.jti_hex) - token.save() - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0002_outstandingtoken_jti_hex"), - ] - - operations = [ - migrations.RunPython(populate_jti_hex, reverse_populate_jti_hex), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0004_auto_20171017_2013.py b/rest_framework_simplejwt/token_blacklist/migrations/0004_auto_20171017_2013.py deleted file mode 100644 index f5ba7e9ff..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0004_auto_20171017_2013.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0003_auto_20171017_2007"), - ] - - operations = [ - migrations.AlterField( - model_name="outstandingtoken", - name="jti_hex", - field=models.CharField(unique=True, max_length=255), - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0005_remove_outstandingtoken_jti.py b/rest_framework_simplejwt/token_blacklist/migrations/0005_remove_outstandingtoken_jti.py deleted file mode 100644 index 2b140ed9f..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0005_remove_outstandingtoken_jti.py +++ /dev/null @@ -1,14 +0,0 @@ -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0004_auto_20171017_2013"), - ] - - operations = [ - migrations.RemoveField( - model_name="outstandingtoken", - name="jti", - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0006_auto_20171017_2113.py b/rest_framework_simplejwt/token_blacklist/migrations/0006_auto_20171017_2113.py deleted file mode 100644 index 10f9f1e2a..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0006_auto_20171017_2113.py +++ /dev/null @@ -1,15 +0,0 @@ -from django.db import migrations - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0005_remove_outstandingtoken_jti"), - ] - - operations = [ - migrations.RenameField( - model_name="outstandingtoken", - old_name="jti_hex", - new_name="jti", - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0007_auto_20171017_2214.py b/rest_framework_simplejwt/token_blacklist/migrations/0007_auto_20171017_2214.py deleted file mode 100644 index 5fa602fd1..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0007_auto_20171017_2214.py +++ /dev/null @@ -1,27 +0,0 @@ -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0006_auto_20171017_2113"), - ] - - operations = [ - migrations.AlterField( - model_name="outstandingtoken", - name="created_at", - field=models.DateTimeField(blank=True, null=True), - ), - migrations.AlterField( - model_name="outstandingtoken", - name="user", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.CASCADE, - to=settings.AUTH_USER_MODEL, - ), - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0008_migrate_to_bigautofield.py b/rest_framework_simplejwt/token_blacklist/migrations/0008_migrate_to_bigautofield.py deleted file mode 100644 index 9a7735729..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0008_migrate_to_bigautofield.py +++ /dev/null @@ -1,24 +0,0 @@ -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0007_auto_20171017_2214"), - ] - - operations = [ - migrations.AlterField( - model_name="blacklistedtoken", - name="id", - field=models.BigAutoField( - auto_created=True, primary_key=True, serialize=False, verbose_name="ID" - ), - ), - migrations.AlterField( - model_name="outstandingtoken", - name="id", - field=models.BigAutoField( - auto_created=True, primary_key=True, serialize=False, verbose_name="ID" - ), - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0010_fix_migrate_to_bigautofield.py b/rest_framework_simplejwt/token_blacklist/migrations/0010_fix_migrate_to_bigautofield.py deleted file mode 100644 index b6d595df9..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0010_fix_migrate_to_bigautofield.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 3.2.3 on 2021-05-27 17:46 - -from pathlib import Path - -from django.db import migrations, models - -parent_dir = Path(__file__).resolve(strict=True).parent - - -class Migration(migrations.Migration): - dependencies = [ - ("token_blacklist", "0008_migrate_to_bigautofield"), - ] - - operations = [ - migrations.AlterField( - model_name="blacklistedtoken", - name="id", - field=models.BigAutoField(primary_key=True, serialize=False), - ), - migrations.AlterField( - model_name="outstandingtoken", - name="id", - field=models.BigAutoField(primary_key=True, serialize=False), - ), - ] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0011_linearizes_history.py b/rest_framework_simplejwt/token_blacklist/migrations/0011_linearizes_history.py deleted file mode 100644 index cd102e0c2..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0011_linearizes_history.py +++ /dev/null @@ -1,18 +0,0 @@ -import fnmatch -import os -from pathlib import Path - -from django.db import migrations, models # noqa F401 - -parent_dir = Path(__file__).resolve(strict=True).parent - - -class Migration(migrations.Migration): - def __init__(self, *args, **kwargs): - super().__init__(*args, **kwargs) - self.dependencies = [("token_blacklist", "0010_fix_migrate_to_bigautofield")] - _m = sorted(fnmatch.filter(os.listdir(parent_dir), "000*.py")) - if len(_m) == 9: - self.dependencies.insert(0, ("token_blacklist", os.path.splitext(_m[8])[0])) - - operations = [] diff --git a/rest_framework_simplejwt/token_blacklist/migrations/0012_alter_outstandingtoken_user.py b/rest_framework_simplejwt/token_blacklist/migrations/0012_alter_outstandingtoken_user.py deleted file mode 100644 index 91d5e0645..000000000 --- a/rest_framework_simplejwt/token_blacklist/migrations/0012_alter_outstandingtoken_user.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 3.2.10 on 2022-01-24 06:42 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - dependencies = [ - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ("token_blacklist", "0011_linearizes_history"), - ] - - operations = [ - migrations.AlterField( - model_name="outstandingtoken", - name="user", - field=models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.SET_NULL, - to=settings.AUTH_USER_MODEL, - ), - ), - ]