From f84b59cb4f1684a773b1f1eec116f6a8ced05c29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Hells=C3=A9n?= Date: Thu, 7 Aug 2025 01:01:46 +0200 Subject: [PATCH] Go back to sqlite --- accounts/migrations/0001_initial.py | 2 +- compose.yaml | 45 ------------------- postgresql.conf | 19 -------- pyproject.toml | 2 +- twitch/migrations/0001_initial.py | 21 ++++++++- .../0002_notificationsubscription.py | 29 ------------ ...onsubscription_unique_together_and_more.py | 34 -------------- ...004_alter_dropbenefit_distribution_type.py | 18 -------- twitch/migrations/0005_game_box_art.py | 18 -------- uv.lock | 12 ++--- 10 files changed, 27 insertions(+), 173 deletions(-) delete mode 100644 compose.yaml delete mode 100644 postgresql.conf delete mode 100644 twitch/migrations/0002_notificationsubscription.py delete mode 100644 twitch/migrations/0003_alter_notificationsubscription_unique_together_and_more.py delete mode 100644 twitch/migrations/0004_alter_dropbenefit_distribution_type.py delete mode 100644 twitch/migrations/0005_game_box_art.py diff --git a/accounts/migrations/0001_initial.py b/accounts/migrations/0001_initial.py index d39a7e4..f720c0d 100644 --- a/accounts/migrations/0001_initial.py +++ b/accounts/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.2.4 on 2025-07-23 23:51 +# Generated by Django 5.2.5 on 2025-08-06 23:01 import django.contrib.auth.models import django.contrib.auth.validators diff --git a/compose.yaml b/compose.yaml deleted file mode 100644 index ff5666c..0000000 --- a/compose.yaml +++ /dev/null @@ -1,45 +0,0 @@ -services: - ttvdrops_postgres: - image: postgres:17-bookworm - environment: - POSTGRES_USER: ttvdrops - POSTGRES_PASSWORD: ${POSTGRES_PASSWORD?You must set POSTGRES_PASSWORD} - POSTGRES_DB: ttvdrops - PGDATA: /data - command: postgres -c config_file=/config/postgresql.conf - shm_size: 5g - ports: - - "5432:5432" - healthcheck: - test: ["CMD-SHELL", "pg_isready", "-d", "ttvdrops", "-U", "ttvdrops"] - interval: 30s - timeout: 60s - retries: 5 - start_period: 30s - restart: always - networks: - - ttvdrops - volumes: - - /mnt/Docker/Data/ttvdrops/postgresql/data:/data - - /mnt/Docker/Data/ttvdrops/postgresql/config:/config - - ttvdrops_pgbouncer: - image: edoburu/pgbouncer - restart: always - depends_on: - - ttvdrops_postgres - ports: - - "6432:6432" - environment: - DB_USER: ttvdrops - DB_PASSWORD: ${POSTGRES_PASSWORD} - DB_HOST: ttvdrops_postgres - DB_NAME: ttvdrops - POOL_MODE: transaction - MAX_CLIENT_CONN: 200 - DEFAULT_POOL_SIZE: 20 - networks: - - ttvdrops - -networks: - ttvdrops: diff --git a/postgresql.conf b/postgresql.conf deleted file mode 100644 index e1dfbf4..0000000 --- a/postgresql.conf +++ /dev/null @@ -1,19 +0,0 @@ -checkpoint_completion_target = 0.9 -default_statistics_target = 100 -effective_cache_size = 12GB -effective_io_concurrency = 200 -huge_pages = off -listen_addresses = '*' -maintenance_work_mem = 1GB -max_connections = 50 -max_parallel_maintenance_workers = 4 -max_parallel_workers = 12 -max_parallel_workers_per_gather = 4 -max_wal_size = 4GB -max_worker_processes = 12 -min_wal_size = 1GB -random_page_cost = 1.1 -shared_buffers = 4GB -superuser_reserved_connections = 3 -wal_buffers = 16MB -work_mem = 19784kB \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 50520e8..cb0892f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -5,11 +5,11 @@ description = "Get notified when a new drop is available on Twitch." readme = "README.md" requires-python = ">=3.13" dependencies = [ - "django>=5.2.4", "django-browser-reload>=1.18.0", "django-debug-toolbar>=5.2.0", "django-stubs[compatible-mypy]>=5.2.2", "django-watchfiles>=1.1.0", + "django>=5.2.4", "djlint>=1.36.4", "orjson>=3.11.1", "platformdirs>=4.3.8", diff --git a/twitch/migrations/0001_initial.py b/twitch/migrations/0001_initial.py index cfdaf6a..55a2a7a 100644 --- a/twitch/migrations/0001_initial.py +++ b/twitch/migrations/0001_initial.py @@ -1,6 +1,7 @@ -# Generated by Django 5.2.4 on 2025-07-23 23:51 +# Generated by Django 5.2.4 on 2025-08-06 04:12 import django.db.models.deletion +from django.conf import settings from django.db import migrations, models @@ -9,6 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -21,7 +23,7 @@ class Migration(migrations.Migration): ('created_at', models.DateTimeField(db_index=True)), ('entitlement_limit', models.PositiveIntegerField(default=1)), ('is_ios_available', models.BooleanField(default=False)), - ('distribution_type', models.TextField(choices=[('DIRECT_ENTITLEMENT', 'Direct Entitlement'), ('CODE', 'Code')], db_index=True)), + ('distribution_type', models.TextField(db_index=True)), ], ), migrations.CreateModel( @@ -38,6 +40,7 @@ class Migration(migrations.Migration): ('id', models.TextField(primary_key=True, serialize=False)), ('slug', models.TextField(blank=True, db_index=True, default='')), ('display_name', models.TextField(db_index=True)), + ('box_art', models.URLField(blank=True, default='', max_length=500)), ], options={ 'indexes': [models.Index(fields=['slug'], name='twitch_game_slug_a02d3c_idx'), models.Index(fields=['display_name'], name='twitch_game_display_a35ba3_idx')], @@ -99,6 +102,20 @@ class Migration(migrations.Migration): name='drop', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='twitch.timebaseddrop'), ), + migrations.CreateModel( + name='NotificationSubscription', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('notify_found', models.BooleanField(default=False)), + ('notify_live', models.BooleanField(default=False)), + ('game', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='twitch.game')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('organization', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='twitch.organization')), + ], + options={ + 'unique_together': {('user', 'game'), ('user', 'organization')}, + }, + ), migrations.AddIndex( model_name='dropcampaign', index=models.Index(fields=['name'], name='twitch_drop_name_3b70b3_idx'), diff --git a/twitch/migrations/0002_notificationsubscription.py b/twitch/migrations/0002_notificationsubscription.py deleted file mode 100644 index 305cb53..0000000 --- a/twitch/migrations/0002_notificationsubscription.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 5.2.4 on 2025-08-02 02:08 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('twitch', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.CreateModel( - name='NotificationSubscription', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('notify_found', models.BooleanField(default=False)), - ('notify_live', models.BooleanField(default=False)), - ('game', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='twitch.game')), - ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), - ], - options={ - 'unique_together': {('user', 'game')}, - }, - ), - ] diff --git a/twitch/migrations/0003_alter_notificationsubscription_unique_together_and_more.py b/twitch/migrations/0003_alter_notificationsubscription_unique_together_and_more.py deleted file mode 100644 index 9b01694..0000000 --- a/twitch/migrations/0003_alter_notificationsubscription_unique_together_and_more.py +++ /dev/null @@ -1,34 +0,0 @@ -# Generated by Django 5.2.4 on 2025-08-02 03:39 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('twitch', '0002_notificationsubscription'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.AlterUniqueTogether( - name='notificationsubscription', - unique_together={('user', 'game')}, - ), - migrations.AddField( - model_name='notificationsubscription', - name='organization', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='twitch.organization'), - ), - migrations.AlterField( - model_name='notificationsubscription', - name='game', - field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='twitch.game'), - ), - migrations.AlterUniqueTogether( - name='notificationsubscription', - unique_together={('user', 'game'), ('user', 'organization')}, - ), - ] diff --git a/twitch/migrations/0004_alter_dropbenefit_distribution_type.py b/twitch/migrations/0004_alter_dropbenefit_distribution_type.py deleted file mode 100644 index 00cebe2..0000000 --- a/twitch/migrations/0004_alter_dropbenefit_distribution_type.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.2.4 on 2025-08-03 22:14 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('twitch', '0003_alter_notificationsubscription_unique_together_and_more'), - ] - - operations = [ - migrations.AlterField( - model_name='dropbenefit', - name='distribution_type', - field=models.TextField(db_index=True), - ), - ] diff --git a/twitch/migrations/0005_game_box_art.py b/twitch/migrations/0005_game_box_art.py deleted file mode 100644 index f5a5fe6..0000000 --- a/twitch/migrations/0005_game_box_art.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.2.4 on 2025-08-04 03:19 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('twitch', '0004_alter_dropbenefit_distribution_type'), - ] - - operations = [ - migrations.AddField( - model_name='game', - name='box_art', - field=models.URLField(blank=True, default='', max_length=500), - ), - ] diff --git a/uv.lock b/uv.lock index 55bd1aa..4d6f197 100644 --- a/uv.lock +++ b/uv.lock @@ -4,15 +4,15 @@ requires-python = ">=3.13" [[package]] name = "anyio" -version = "4.9.0" +version = "4.10.0" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "idna" }, { name = "sniffio" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/95/7d/4c1bd541d4dffa1b52bd83fb8527089e097a106fc90b467a7313b105f840/anyio-4.9.0.tar.gz", hash = "sha256:673c0c244e15788651a4ff38710fea9675823028a6f08a5eda409e0c9840a028", size = 190949, upload-time = "2025-03-17T00:02:54.77Z" } +sdist = { url = "https://files.pythonhosted.org/packages/f1/b4/636b3b65173d3ce9a38ef5f0522789614e590dab6a8d505340a4efe4c567/anyio-4.10.0.tar.gz", hash = "sha256:3f3fae35c96039744587aa5b8371e7e8e603c0702999535961dd336026973ba6", size = 213252, upload-time = "2025-08-04T08:54:26.451Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/a1/ee/48ca1a7c89ffec8b6a0c5d02b89c305671d5ffd8d3c94acf8b8c408575bb/anyio-4.9.0-py3-none-any.whl", hash = "sha256:9f76d541cad6e36af7beb62e978876f3b41e3e04f2c1fbf0884604c0a9c4d93c", size = 100916, upload-time = "2025-03-17T00:02:52.713Z" }, + { url = "https://files.pythonhosted.org/packages/6f/12/e5e0282d673bb9746bacfb6e2dba8719989d3660cdb2ea79aee9a9651afb/anyio-4.10.0-py3-none-any.whl", hash = "sha256:60e474ac86736bbfd6f210f7a61218939c318f43f9972497381f1c5e930ed3d1", size = 107213, upload-time = "2025-08-04T08:54:24.882Z" }, ] [[package]] @@ -61,16 +61,16 @@ wheels = [ [[package]] name = "django" -version = "5.2.4" +version = "5.2.5" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "asgiref" }, { name = "sqlparse" }, { name = "tzdata", marker = "sys_platform == 'win32'" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/9c/7e/034f0f9fb10c029a02daaf44d364d6bf2eced8c73f0d38c69da359d26b01/django-5.2.4.tar.gz", hash = "sha256:a1228c384f8fa13eebc015196db7b3e08722c5058d4758d20cb287503a540d8f", size = 10831909, upload-time = "2025-07-02T18:47:39.19Z" } +sdist = { url = "https://files.pythonhosted.org/packages/62/9b/779f853c3d2d58b9e08346061ff3e331cdec3fe3f53aae509e256412a593/django-5.2.5.tar.gz", hash = "sha256:0745b25681b129a77aae3d4f6549b62d3913d74407831abaa0d9021a03954bae", size = 10859748, upload-time = "2025-08-06T08:26:29.978Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/14/ae/706965237a672434c8b520e89a818e8b047af94e9beb342d0bee405c26c7/django-5.2.4-py3-none-any.whl", hash = "sha256:60c35bd96201b10c6e7a78121bd0da51084733efa303cc19ead021ab179cef5e", size = 8302187, upload-time = "2025-07-02T18:47:35.373Z" }, + { url = "https://files.pythonhosted.org/packages/9d/6e/98a1d23648e0085bb5825326af17612ecd8fc76be0ce96ea4dc35e17b926/django-5.2.5-py3-none-any.whl", hash = "sha256:2b2ada0ee8a5ff743a40e2b9820d1f8e24c11bac9ae6469cd548f0057ea6ddcd", size = 8302999, upload-time = "2025-08-06T08:26:23.562Z" }, ] [[package]]