diff --git a/.env.test b/.env.test index f018559..2da1f73 100644 --- a/.env.test +++ b/.env.test @@ -10,4 +10,5 @@ RECORDER_ENABLED=False INSECURE_COOKIES=True DJANGO_SUPERUSER_USERNAME=admin DJANGO_SUPERUSER_PASSWORD=admin -STEAM_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx \ No newline at end of file +STEAM_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx +SENTRY_ENABLED=False diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..63772a3 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Spybot2/settings.py b/Spybot2/settings.py index 3583efb..551da60 100644 --- a/Spybot2/settings.py +++ b/Spybot2/settings.py @@ -44,7 +44,8 @@ STEAM_API_KEY = env('STEAM_API_KEY') # Sentry SDK -SENTRY_DSN = env('SENTRY_DSN') +SENTRY_ENABLED = env.bool('SENTRY_ENABLED', False) +SENTRY_DSN = env('SENTRY_DSN', default="") # SECURITY WARNING: don't run with debug turned on in production! DEBUG = env.bool('DEBUG', False) @@ -230,13 +231,14 @@ 'javascript_in_head': False, } -sentry_sdk.init( - dsn=SENTRY_DSN, - # Set traces_sample_rate to 1.0 to capture 100% - # of transactions for tracing. - traces_sample_rate=1.0, - # Set profiles_sample_rate to 1.0 to profile 100% - # of sampled transactions. - # We recommend adjusting this value in production. - profiles_sample_rate=1.0, -) \ No newline at end of file +if SENTRY_ENABLED: + sentry_sdk.init( + dsn=SENTRY_DSN, + # Set traces_sample_rate to 1.0 to capture 100% + # of transactions for tracing. + traces_sample_rate=1.0, + # Set profiles_sample_rate to 1.0 to profile 100% + # of sampled transactions. + # We recommend adjusting this value in production. + profiles_sample_rate=1.0, + ) \ No newline at end of file diff --git a/spybot/migrations/0001_initial.py b/spybot/migrations/0001_initial.py index e5546a3..ee2c75a 100644 --- a/spybot/migrations/0001_initial.py +++ b/spybot/migrations/0001_initial.py @@ -1,9 +1,10 @@ -# Generated by Django 4.1.3 on 2022-12-04 22:47 +# Generated by Django 4.2.15 on 2024-08-27 16:22 +from django.conf import settings from django.db import migrations, models import django.db.models.deletion - -from spybot.models import MergedUserManager +import django.utils.timezone +import uuid class Migration(migrations.Migration): @@ -14,25 +15,31 @@ class Migration(migrations.Migration): ] operations = [ - migrations.SeparateDatabaseAndState( - state_operations=[ - migrations.CreateModel( - name="MergedUser", - fields=[ - ( - "id", - models.AutoField( - auto_created=True, - primary_key=True, - serialize=False, - verbose_name="ID", - ), - ) - ], - options={"db_table": "auth_user"}, - managers=[("objects", MergedUserManager())], - ) - ] + migrations.CreateModel( + name='MergedUser', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('name', models.CharField(max_length=128)), + ('obsolete', models.BooleanField(default=False)), + ('is_superuser', models.BooleanField(default=False)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='NewsEvent', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.CharField(max_length=1024)), + ('website_link', models.CharField(max_length=256, null=True)), + ('date', models.DateTimeField(auto_now_add=True)), + ], + options={ + 'abstract': False, + }, ), migrations.CreateModel( name='TSChannel', @@ -49,9 +56,11 @@ class Migration(migrations.Migration): migrations.CreateModel( name='TSUser', fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('id', models.AutoField(primary_key=True, serialize=False)), ('name', models.CharField(blank=True, max_length=128, null=True)), ('client_id', models.PositiveIntegerField(db_column='clientID')), + ('online', models.BooleanField(db_column='isCurrentlyOnline', default=False)), + ('merged_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tsusers', to=settings.AUTH_USER_MODEL)), ], options={ 'db_table': 'TSUser', @@ -59,20 +68,18 @@ class Migration(migrations.Migration): }, ), migrations.CreateModel( - name='TSUserActivity', + name='UserPasskey', fields=[ - ('id', models.IntegerField(primary_key=True, serialize=False)), - ('start_time', models.DateTimeField(blank=True, db_column='startTime', null=True)), - ('end_time', models.DateTimeField(blank=True, db_column='endTime', null=True)), - ('joined', models.BooleanField(default=False)), - ('disconnect_id', models.IntegerField(blank=True, db_column='discID', null=True)), - ('channel_id', models.ForeignKey(db_column='cID', on_delete=django.db.models.deletion.DO_NOTHING, to='spybot.tschannel')), - ('tsuser_id', models.ForeignKey(blank=True, db_column='tsUserID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='spybot.tsuser')), + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=255)), + ('enabled', models.BooleanField(default=True)), + ('platform', models.CharField(default='', max_length=255)), + ('added_on', models.DateTimeField(auto_now_add=True)), + ('last_used', models.DateTimeField(default=None, null=True)), + ('credential_id', models.CharField(max_length=255, unique=True)), + ('token', models.CharField(max_length=1024)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), ], - options={ - 'db_table': 'TSUserActivity', - 'managed': True, - }, ), migrations.CreateModel( name='TSID', @@ -85,4 +92,83 @@ class Migration(migrations.Migration): 'managed': True, }, ), + migrations.CreateModel( + name='SteamID', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('steam_id', models.BigIntegerField(default=0)), + ('account_name', models.CharField(blank=True, max_length=128, null=True)), + ('merged_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='steamids', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='QueuedClientMessage', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.CharField(max_length=1024)), + ('type', models.CharField(max_length=128)), + ('date', models.DateField(auto_now_add=True)), + ('tsuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='spybot.tsuser')), + ], + ), + migrations.CreateModel( + name='LoginLink', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('code', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='loginlinks', to=settings.AUTH_USER_MODEL)), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='HourlyActivity', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('datetime', models.DateTimeField(default=django.utils.timezone.now)), + ('activity_hours', models.FloatField()), + ], + options={ + 'db_table': 'HourlyActivity', + 'indexes': [models.Index(fields=['datetime'], name='HourlyActiv_datetim_96f0af_idx')], + }, + ), + migrations.CreateModel( + name='Award', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('date', models.DateTimeField(auto_now_add=True)), + ('type', models.CharField(choices=[('USER_OF_WEEK', 'User of the week')], default='USER_OF_WEEK', max_length=64)), + ('points', models.IntegerField()), + ('tsuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='awards', to='spybot.tsuser')), + ], + options={ + 'abstract': False, + }, + ), + migrations.CreateModel( + name='TSUserActivity', + fields=[ + ('id', models.IntegerField(primary_key=True, serialize=False)), + ('start_time', models.DateTimeField(blank=True, db_column='startTime', null=True)), + ('end_time', models.DateTimeField(blank=True, db_column='endTime', null=True)), + ('joined', models.BooleanField(default=False)), + ('disconnect_id', models.IntegerField(blank=True, db_column='discID', null=True)), + ('channel', models.ForeignKey(db_column='cID', on_delete=django.db.models.deletion.DO_NOTHING, to='spybot.tschannel')), + ('tsuser', models.ForeignKey(blank=True, db_column='tsUserID', null=True, on_delete=django.db.models.deletion.DO_NOTHING, to='spybot.tsuser')), + ], + options={ + 'db_table': 'TSUserActivity', + 'managed': True, + 'indexes': [models.Index(fields=['start_time'], name='TSUserActiv_startTi_95ea75_idx')], + }, + ), + migrations.AddConstraint( + model_name='queuedclientmessage', + constraint=models.UniqueConstraint(fields=('tsuser', 'type'), name='constraint_unique_type_user'), + ), ] diff --git a/spybot/migrations/0002_tsuser_online.py b/spybot/migrations/0002_tsuser_online.py deleted file mode 100644 index 52520da..0000000 --- a/spybot/migrations/0002_tsuser_online.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-04 23:33 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='tsuser', - name='online', - field=models.BooleanField(db_column='isCurrentlyOnline', default=False), - ), - ] diff --git a/spybot/migrations/0003_rename_channel_id_tsuseractivity_channel_and_more.py b/spybot/migrations/0003_rename_channel_id_tsuseractivity_channel_and_more.py deleted file mode 100644 index f7dcef6..0000000 --- a/spybot/migrations/0003_rename_channel_id_tsuseractivity_channel_and_more.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-09 22:47 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0002_tsuser_online'), - ] - - operations = [ - migrations.RenameField( - model_name='tsuseractivity', - old_name='channel_id', - new_name='channel', - ), - migrations.RenameField( - model_name='tsuseractivity', - old_name='tsuser_id', - new_name='tsuser', - ), - ] diff --git a/spybot/migrations/0004_hourlyactivity.py b/spybot/migrations/0004_hourlyactivity.py deleted file mode 100644 index 942e84c..0000000 --- a/spybot/migrations/0004_hourlyactivity.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-13 19:43 - -from django.db import migrations, models -import django.utils.timezone - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0003_rename_channel_id_tsuseractivity_channel_and_more'), - ] - - operations = [ - migrations.CreateModel( - name='HourlyActivity', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('datetime', models.DateTimeField(default=django.utils.timezone.now)), - ('activity_hours', models.FloatField()), - ], - options={ - 'db_table': 'HourlyActivity', - }, - ), - ] diff --git a/spybot/migrations/0005_hourlyactivity_hourlyactiv_datetim_96f0af_idx.py b/spybot/migrations/0005_hourlyactivity_hourlyactiv_datetim_96f0af_idx.py deleted file mode 100644 index 74dd201..0000000 --- a/spybot/migrations/0005_hourlyactivity_hourlyactiv_datetim_96f0af_idx.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-13 20:06 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0004_hourlyactivity'), - ] - - operations = [ - migrations.AddIndex( - model_name='hourlyactivity', - index=models.Index(fields=['datetime'], name='HourlyActiv_datetim_96f0af_idx'), - ), - ] diff --git a/spybot/migrations/0006_tsuseractivity_tsuseractiv_startti_95ea75_idx.py b/spybot/migrations/0006_tsuseractivity_tsuseractiv_startti_95ea75_idx.py deleted file mode 100644 index b901d79..0000000 --- a/spybot/migrations/0006_tsuseractivity_tsuseractiv_startti_95ea75_idx.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.1.3 on 2022-12-14 11:09 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0005_hourlyactivity_hourlyactiv_datetim_96f0af_idx'), - ] - - operations = [ - migrations.AddIndex( - model_name='tsuseractivity', - index=models.Index(fields=['start_time'], name='TSUserActiv_startTi_95ea75_idx'), - ), - ] diff --git a/spybot/migrations/0007_alter_tsuser_id_queuedclientmessage_award_and_more.py b/spybot/migrations/0007_alter_tsuser_id_queuedclientmessage_award_and_more.py deleted file mode 100644 index 9ccd2fe..0000000 --- a/spybot/migrations/0007_alter_tsuser_id_queuedclientmessage_award_and_more.py +++ /dev/null @@ -1,46 +0,0 @@ -# Generated by Django 4.1.4 on 2022-12-30 19:01 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0006_tsuseractivity_tsuseractiv_startti_95ea75_idx'), - ] - - operations = [ - migrations.AlterField( - model_name='tsuser', - name='id', - field=models.PositiveIntegerField(primary_key=True, serialize=False), - ), - migrations.CreateModel( - name='QueuedClientMessage', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('text', models.CharField(max_length=1024)), - ('type', models.CharField(max_length=128)), - ('date', models.DateField(auto_now_add=True)), - ('tsuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='spybot.tsuser')), - ], - ), - migrations.CreateModel( - name='Award', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('date', models.DateField(auto_now_add=True)), - ('type', models.CharField(choices=[('USER_OF_WEEK', 'User of the week')], default='USER_OF_WEEK', max_length=64)), - ('points', models.IntegerField()), - ('tsuser', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='spybot.tsuser')), - ], - options={ - 'abstract': False, - }, - ), - migrations.AddConstraint( - model_name='queuedclientmessage', - constraint=models.UniqueConstraint(fields=('tsuser', 'type'), name='constraint_unique_type_user'), - ), - ] diff --git a/spybot/migrations/0008_alter_award_date.py b/spybot/migrations/0008_alter_award_date.py deleted file mode 100644 index 44941bc..0000000 --- a/spybot/migrations/0008_alter_award_date.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.4 on 2023-01-09 19:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0007_alter_tsuser_id_queuedclientmessage_award_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='award', - name='date', - field=models.DateTimeField(auto_now_add=True), - ), - ] diff --git a/spybot/migrations/0009_newsevent.py b/spybot/migrations/0009_newsevent.py deleted file mode 100644 index b26f9f8..0000000 --- a/spybot/migrations/0009_newsevent.py +++ /dev/null @@ -1,25 +0,0 @@ -# Generated by Django 4.1.4 on 2023-01-15 16:54 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0008_alter_award_date'), - ] - - operations = [ - migrations.CreateModel( - name='NewsEvent', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('text', models.CharField(max_length=1024)), - ('website_link', models.CharField(max_length=256, null=True)), - ('date', models.DateTimeField(auto_now_add=True)), - ], - options={ - 'abstract': False, - }, - ), - ] diff --git a/spybot/migrations/0010_alter_tsuser_id.py b/spybot/migrations/0010_alter_tsuser_id.py deleted file mode 100644 index bb59b62..0000000 --- a/spybot/migrations/0010_alter_tsuser_id.py +++ /dev/null @@ -1,19 +0,0 @@ -# Generated by Django 4.1.5 on 2023-01-16 20:53 - -from django.db import migrations -import spybot.models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0009_newsevent'), - ] - - operations = [ - migrations.AlterField( - model_name='tsuser', - name='id', - field=spybot.models.PositiveAutoField(primary_key=True, serialize=False), - ), - ] diff --git a/spybot/migrations/0011_alter_tsuser_id.py b/spybot/migrations/0011_alter_tsuser_id.py deleted file mode 100644 index a76e8ba..0000000 --- a/spybot/migrations/0011_alter_tsuser_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.1.7 on 2023-02-21 10:22 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0010_alter_tsuser_id'), - ] - - operations = [ - migrations.AlterField( - model_name='tsuser', - name='id', - field=models.AutoField(primary_key=True, serialize=False), - ), - ] diff --git a/spybot/migrations/0012_mergeduser_tsuser_merged_user.py b/spybot/migrations/0012_mergeduser_tsuser_merged_user.py deleted file mode 100644 index 244f4f8..0000000 --- a/spybot/migrations/0012_mergeduser_tsuser_merged_user.py +++ /dev/null @@ -1,51 +0,0 @@ -# Generated by Django 4.1.7 on 2023-07-02 14:30 - -from django.db import migrations, models -import django.db.models.deletion - - -def create_merged_users(apps, schema_editor): - TSUser = apps.get_model("spybot", "TSUser") - MergedUser = apps.get_model("spybot", "MergedUser") - for user in TSUser.objects.all(): - merged = MergedUser(name=user.name) - merged.save() - user.merged_user = merged - user.save() - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0011_alter_tsuser_id'), - ] - - operations = [ - migrations.CreateModel( - name='MergedUser', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=128)), - ], - options={ - 'abstract': False, - }, - ), - migrations.AddField( - model_name='tsuser', - name='merged_user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='spybot.mergeduser'), - ), - migrations.AddField( - model_name='mergeduser', - name='obsolete', - field=models.BooleanField(default=False), - ), - migrations.AlterField( - model_name='tsuser', - name='merged_user', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='tsusers', - to='spybot.mergeduser'), - ), - migrations.RunPython(create_merged_users) - ] diff --git a/spybot/migrations/0013_migrate_old_newsevent_links.py b/spybot/migrations/0013_migrate_old_newsevent_links.py deleted file mode 100644 index e46bb8b..0000000 --- a/spybot/migrations/0013_migrate_old_newsevent_links.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 4.1.7 on 2023-07-04 16:29 -import re - -from django.db import migrations - - -def migrate_old_news_events(apps, schema_editor): - NewsEvent = apps.get_model("spybot", "NewsEvent") - TSUser = apps.get_model("spybot", "TSUser") - - old_link_pattern = re.compile(r'/u/(\d+)\Z') - for news_event in NewsEvent.objects.all(): - old_link = news_event.website_link - match = old_link_pattern.match(old_link) - if match: - old_id = int(match.group(1)) - tsuser = TSUser.objects.get(id=old_id) - new_id = tsuser.merged_user_id - new_link = f"/u/{new_id}" - if new_link != old_link: - news_event.website_link = new_link - news_event.save() - print(f"Migrated old link {old_link} to {new_link}") - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0012_mergeduser_tsuser_merged_user'), - ] - - operations = [ - migrations.RunPython(migrate_old_news_events) - ] diff --git a/spybot/migrations/0014_mergeduser_steam_id_alter_award_tsuser.py b/spybot/migrations/0014_mergeduser_steam_id_alter_award_tsuser.py deleted file mode 100644 index 36cbc64..0000000 --- a/spybot/migrations/0014_mergeduser_steam_id_alter_award_tsuser.py +++ /dev/null @@ -1,24 +0,0 @@ -# Generated by Django 4.2.3 on 2023-07-07 18:49 - -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0013_migrate_old_newsevent_links'), - ] - - operations = [ - migrations.AddField( - model_name='mergeduser', - name='steam_id', - field=models.IntegerField(default=0), - ), - migrations.AlterField( - model_name='award', - name='tsuser', - field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='awards', to='spybot.tsuser'), - ), - ] diff --git a/spybot/migrations/0015_alter_mergeduser_steam_id.py b/spybot/migrations/0015_alter_mergeduser_steam_id.py deleted file mode 100644 index 830abd3..0000000 --- a/spybot/migrations/0015_alter_mergeduser_steam_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.2.3 on 2023-07-07 19:38 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0014_mergeduser_steam_id_alter_award_tsuser'), - ] - - operations = [ - migrations.AlterField( - model_name='mergeduser', - name='steam_id', - field=models.BigIntegerField(default=0), - ), - ] diff --git a/spybot/migrations/0016_steamid.py b/spybot/migrations/0016_steamid.py deleted file mode 100644 index c7fec82..0000000 --- a/spybot/migrations/0016_steamid.py +++ /dev/null @@ -1,41 +0,0 @@ -# Generated by Django 4.2.3 on 2023-07-16 20:41 - -from django.db import migrations, models -import django.db.models.deletion - - -def migrate_old_steam_ids(apps, schema_editor): - MergedUser = apps.get_model("spybot", "MergedUser") - SteamID = apps.get_model("spybot", "SteamID") - - for mu in MergedUser.objects.all(): - sid = mu.steam_id - if sid != 0: - steam_id = SteamID(merged_user=mu, steam_id=sid) - steam_id.save() - mu.steam_id = 0 - mu.save() - print(f"Migrated old steam_id {sid} of user {mu.id}") - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0015_alter_mergeduser_steam_id'), - ] - - operations = [ - migrations.CreateModel( - name='SteamID', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('steam_id', models.BigIntegerField(default=0)), - ('merged_user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='steamids', to='spybot.mergeduser')), - ], - options={ - 'abstract': False, - }, - ), - - migrations.RunPython(migrate_old_steam_ids) - ] diff --git a/spybot/migrations/0017_remove_mergeduser_steam_id.py b/spybot/migrations/0017_remove_mergeduser_steam_id.py deleted file mode 100644 index 3f17ac1..0000000 --- a/spybot/migrations/0017_remove_mergeduser_steam_id.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 4.2.3 on 2023-07-16 21:06 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0016_steamid'), - ] - - operations = [ - migrations.RemoveField( - model_name='mergeduser', - name='steam_id', - ), - ] diff --git a/spybot/migrations/0018_steamid_account_name.py b/spybot/migrations/0018_steamid_account_name.py deleted file mode 100644 index ffa3a4b..0000000 --- a/spybot/migrations/0018_steamid_account_name.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.2.3 on 2023-07-16 21:25 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0017_remove_mergeduser_steam_id'), - ] - - operations = [ - migrations.AddField( - model_name='steamid', - name='account_name', - field=models.CharField(blank=True, max_length=128, null=True), - ), - ] diff --git a/spybot/migrations/0019_mergeduser_last_login_mergeduser_password_loginlink.py b/spybot/migrations/0019_mergeduser_last_login_mergeduser_password_loginlink.py deleted file mode 100644 index 7518a8e..0000000 --- a/spybot/migrations/0019_mergeduser_last_login_mergeduser_password_loginlink.py +++ /dev/null @@ -1,38 +0,0 @@ -# Generated by Django 4.2.3 on 2023-11-13 17:19 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion -import uuid - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0018_steamid_account_name'), - ] - - operations = [ - migrations.AddField( - model_name='mergeduser', - name='last_login', - field=models.DateTimeField(blank=True, null=True, verbose_name='last login'), - ), - migrations.AddField( - model_name='mergeduser', - name='password', - field=models.CharField(default='none', max_length=128, verbose_name='password'), - preserve_default=False, - ), - migrations.CreateModel( - name='LoginLink', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('code', models.UUIDField(default=uuid.uuid4, editable=False, unique=True)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='loginlinks', to=settings.AUTH_USER_MODEL)), - ], - options={ - 'abstract': False, - }, - ), - ] diff --git a/spybot/migrations/0020_mergeduser_is_superuser.py b/spybot/migrations/0020_mergeduser_is_superuser.py deleted file mode 100644 index 40ec75f..0000000 --- a/spybot/migrations/0020_mergeduser_is_superuser.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 4.2.3 on 2024-01-28 16:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0019_mergeduser_last_login_mergeduser_password_loginlink'), - ] - - operations = [ - migrations.AddField( - model_name='mergeduser', - name='is_superuser', - field=models.BooleanField(default=False), - ), - migrations.RunSQL("UPDATE spybot_mergeduser SET is_superuser=true WHERE id=657;"), - migrations.RunSQL("UPDATE spybot_mergeduser SET is_superuser=true WHERE id=641;"), - ] diff --git a/spybot/migrations/0021_userpasskey.py b/spybot/migrations/0021_userpasskey.py deleted file mode 100644 index 85f3ef9..0000000 --- a/spybot/migrations/0021_userpasskey.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 4.2.3 on 2024-06-01 15:25 - -from django.conf import settings -from django.db import migrations, models -import django.db.models.deletion - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0020_mergeduser_is_superuser'), - ] - - operations = [ - migrations.CreateModel( - name='UserPasskey', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=255)), - ('enabled', models.BooleanField(default=True)), - ('platform', models.CharField(default='', max_length=255)), - ('added_on', models.DateTimeField(auto_now_add=True)), - ('last_used', models.DateTimeField(default=None, null=True)), - ('credential_id', models.CharField(max_length=255, unique=True)), - ('token', models.CharField(max_length=255)), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - ), - ] diff --git a/spybot/migrations/0022_alter_userpasskey_token.py b/spybot/migrations/0022_alter_userpasskey_token.py deleted file mode 100644 index 3201484..0000000 --- a/spybot/migrations/0022_alter_userpasskey_token.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 4.2.3 on 2024-07-06 16:10 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('spybot', '0021_userpasskey'), - ] - - operations = [ - migrations.AlterField( - model_name='userpasskey', - name='token', - field=models.CharField(max_length=1024), - ), - ]