Reusable Django app for system monitoring. Built to make dev environment more like production environment. Combines celery with gunicorn and daphne.
Removed the migrations
15 files changed, +0 -100
+0-29smartwatch/migrations/0001_initial.py
| @@ -1,29 +0,0 @@ | ||
| 1 | -# Generated by Django 5.0.7 on 2024-10-31 11:38 | |
| 2 | - | |
| 3 | -from django.db import migrations, models | |
| 4 | - | |
| 5 | - | |
| 6 | -class Migration(migrations.Migration): | |
| 7 | - | |
| 8 | - initial = True | |
| 9 | - | |
| 10 | - dependencies = [] | |
| 11 | - | |
| 12 | - operations = [ | |
| 13 | - migrations.CreateModel( | |
| 14 | - name="FileHash", | |
| 15 | - fields=[ | |
| 16 | - ( | |
| 17 | - "id", | |
| 18 | - models.BigAutoField( | |
| 19 | - auto_created=True, | |
| 20 | - primary_key=True, | |
| 21 | - serialize=False, | |
| 22 | - verbose_name="ID", | |
| 23 | - ), | |
| 24 | - ), | |
| 25 | - ("file_path", models.CharField(max_length=1000)), | |
| 26 | - ("md5_hash", models.CharField(max_length=32)), | |
| 27 | - ], | |
| 28 | - ), | |
| 29 | - ] |
+0-38smartwatch/migrations/0002_alter_filehash_file_path.py
| @@ -1,38 +0,0 @@ | ||
| 1 | -# Generated by Django 5.0.7 on 2024-10-31 12:44 | |
| 2 | - | |
| 3 | -import logging | |
| 4 | -from django.db import migrations, models | |
| 5 | - | |
| 6 | - | |
| 7 | -def handle_duplicates(apps, _): | |
| 8 | - try: | |
| 9 | - FileHash = apps.get_model("smartwatch", "FileHash") | |
| 10 | - duplicates = ( | |
| 11 | - FileHash.objects.values("file_path") | |
| 12 | - .annotate(count=models.Count("id")) | |
| 13 | - .filter(count__gt=1) | |
| 14 | - ) | |
| 15 | - | |
| 16 | - for duplicate in duplicates: | |
| 17 | - file_path = duplicate["file_path"] | |
| 18 | - duplicate_entries = FileHash.objects.filter(file_path=file_path) | |
| 19 | - # Keep the first entry and delete the rest | |
| 20 | - first_entry = duplicate_entries.first() | |
| 21 | - duplicate_entries.exclude(id=first_entry.id).delete() | |
| 22 | - except Exception: | |
| 23 | - logging.error("Error while handling duplicates") | |
| 24 | - | |
| 25 | - | |
| 26 | -class Migration(migrations.Migration): | |
| 27 | - dependencies = [ | |
| 28 | - ("smartwatch", "0001_initial"), | |
| 29 | - ] | |
| 30 | - | |
| 31 | - operations = [ | |
| 32 | - migrations.RunPython(handle_duplicates), | |
| 33 | - migrations.AlterField( | |
| 34 | - model_name="filehash", | |
| 35 | - name="file_path", | |
| 36 | - field=models.CharField(max_length=1000, unique=True), | |
| 37 | - ), | |
| 38 | - ] |
+0-17smartwatch/migrations/0003_rename_filehash_smartfile.py
| @@ -1,17 +0,0 @@ | ||
| 1 | -# Generated by Django 5.0.7 on 2024-11-02 22:47 | |
| 2 | - | |
| 3 | -from django.db import migrations | |
| 4 | - | |
| 5 | - | |
| 6 | -class Migration(migrations.Migration): | |
| 7 | - | |
| 8 | - dependencies = [ | |
| 9 | - ("smartwatch", "0002_alter_filehash_file_path"), | |
| 10 | - ] | |
| 11 | - | |
| 12 | - operations = [ | |
| 13 | - migrations.RenameModel( | |
| 14 | - old_name="FileHash", | |
| 15 | - new_name="SmartFile", | |
| 16 | - ), | |
| 17 | - ] |
+0-16smartwatch/migrations/0004_delete_smartfile.py
| @@ -1,16 +0,0 @@ | ||
| 1 | -# Generated by Django 5.0.7 on 2024-12-04 21:55 | |
| 2 | - | |
| 3 | -from django.db import migrations | |
| 4 | - | |
| 5 | - | |
| 6 | -class Migration(migrations.Migration): | |
| 7 | - | |
| 8 | - dependencies = [ | |
| 9 | - ("smartwatch", "0003_rename_filehash_smartfile"), | |
| 10 | - ] | |
| 11 | - | |
| 12 | - operations = [ | |
| 13 | - migrations.DeleteModel( | |
| 14 | - name="SmartFile", | |
| 15 | - ), | |
| 16 | - ] |
+0-0smartwatch/migrations/__init__.py
No content changes (mode or rename only).
+0-0smartwatch/migrations/__pycache__/0001_initial.cpython-312.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0001_initial.pypy310.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0002_alter_filehash_file_path.cpython-312.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0002_alter_filehash_file_path.pypy310.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0003_rename_filehash_smartfile.cpython-312.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0003_rename_filehash_smartfile.pypy310.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0004_delete_smartfile.cpython-312.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/0004_delete_smartfile.pypy310.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/__init__.cpython-312.pyc
Binary file changed.
+0-0smartwatch/migrations/__pycache__/__init__.pypy310.pyc
Binary file changed.