From 65212046089e5a9b05020d9c665028a8097d4375 Mon Sep 17 00:00:00 2001 From: Kumi Date: Fri, 17 May 2024 13:27:49 +0200 Subject: [PATCH] feat: Add initial migrations for GPS and Mood modules Introduced initial database migrations for GPS logging and Mood tracking functionality, setting the foundation for data model structures in these modules. The migrations define essential entities such as GPSTrack, GPSToken, GPSPoint for the GPS logging module, and Mood, Activity, Aspect among others for the Mood tracking module. This pivotal change enables storing and managing user-generated GPS and mood data efficiently, paving the way for the implementation of core features related to GPS tracking and mood analysis. By removing 'migrations/' from .gitignore, we ensure future migrations are tracked and version-controlled, facilitating smoother database schema updates and deployments. --- .gitignore | 1 - gpslog/migrations/0001_initial.py | 54 ++++++++++++++ gpslog/migrations/__init__.py | 0 mood/migrations/0001_initial.py | 119 ++++++++++++++++++++++++++++++ mood/migrations/__init__.py | 0 5 files changed, 173 insertions(+), 1 deletion(-) create mode 100644 gpslog/migrations/0001_initial.py create mode 100644 gpslog/migrations/__init__.py create mode 100644 mood/migrations/0001_initial.py create mode 100644 mood/migrations/__init__.py diff --git a/.gitignore b/.gitignore index 9aadee2..679cb0f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ __pycache__/ *.pyc db.sqlite3 -migrations/ venv/ localsettings.py settings.ini \ No newline at end of file diff --git a/gpslog/migrations/0001_initial.py b/gpslog/migrations/0001_initial.py new file mode 100644 index 0000000..d5fcc22 --- /dev/null +++ b/gpslog/migrations/0001_initial.py @@ -0,0 +1,54 @@ +# Generated by Django 4.1.1 on 2022-09-09 16:07 + +from django.conf import settings +import django.contrib.gis.db.models.fields +from django.db import migrations, models +import django.db.models.deletion +import uuid + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='GPSTrack', + fields=[ + ('id', models.UUIDField(default=uuid.uuid4, primary_key=True, serialize=False)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='GPSToken', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(blank=True, max_length=128, null=True)), + ('token', models.UUIDField(default=uuid.uuid4)), + ('read', models.BooleanField(default=False)), + ('write', models.BooleanField(default=False)), + ('history', models.BooleanField(default=False)), + ('track', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gpslog.gpstrack')), + ], + ), + migrations.CreateModel( + name='GPSPoint', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('point', django.contrib.gis.db.models.fields.PointField(srid=4326)), + ('timestamp', models.DateTimeField()), + ('battery', models.DecimalField(blank=True, decimal_places=2, max_digits=5, null=True)), + ('accuracy', models.DecimalField(blank=True, decimal_places=32, max_digits=64, null=True)), + ('speed', models.DecimalField(blank=True, decimal_places=32, max_digits=64, null=True)), + ('bearing', models.DecimalField(blank=True, decimal_places=61, max_digits=64, null=True)), + ('satellites', models.IntegerField(blank=True, null=True)), + ('user_agent', models.TextField(blank=True, null=True)), + ('token', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='gpslog.gpstoken')), + ('track', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='gpslog.gpstrack')), + ], + ), + ] diff --git a/gpslog/migrations/__init__.py b/gpslog/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/mood/migrations/0001_initial.py b/mood/migrations/0001_initial.py new file mode 100644 index 0000000..e41027f --- /dev/null +++ b/mood/migrations/0001_initial.py @@ -0,0 +1,119 @@ +# Generated by Django 5.0.6 on 2024-05-17 11:27 + +import colorfield.fields +import common.helpers +import django.core.validators +import django.db.models.deletion +import django.utils.timezone +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='ActivityCategory', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), + ('icon', models.CharField(default='fas fa-check', max_length=64)), + ('color', colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Activity', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), + ('icon', models.CharField(default='fas fa-check', max_length=64)), + ('color', colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ('category', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='mood.activitycategory')), + ], + options={ + 'ordering': ['name'], + }, + ), + migrations.CreateModel( + name='Aspect', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), + ('icon', models.CharField(blank=True, max_length=64, null=True)), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='AspectRating', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), + ('icon', models.CharField(default='fas fa-star', max_length=64)), + ('color', colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None)), + ('value', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])), + ('aspect', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mood.aspect')), + ], + ), + migrations.CreateModel( + name='Mood', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=64)), + ('icon', models.CharField(default='fas fa-star', max_length=64)), + ('color', colorfield.fields.ColorField(default='#000000', image_field=None, max_length=25, samples=None)), + ('value', models.IntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['-value'], + }, + ), + migrations.CreateModel( + name='Status', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('timestamp', models.DateTimeField(default=django.utils.timezone.now)), + ('title', models.CharField(blank=True, max_length=64, null=True)), + ('text', models.TextField(blank=True, null=True)), + ('mood', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='mood.mood')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + options={ + 'ordering': ['timestamp'], + }, + ), + migrations.CreateModel( + name='StatusActivity', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comment', models.TextField(blank=True, null=True)), + ('activity', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mood.activity')), + ('status', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mood.status')), + ], + ), + migrations.CreateModel( + name='StatusAspectRating', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('comment', models.TextField(blank=True, null=True)), + ('aspect_rating', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='mood.aspectrating')), + ('status', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mood.status')), + ], + ), + migrations.CreateModel( + name='StatusMedia', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('file', models.FileField(upload_to='', verbose_name=common.helpers.get_upload_path)), + ('status', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mood.status')), + ], + ), + ] diff --git a/mood/migrations/__init__.py b/mood/migrations/__init__.py new file mode 100644 index 0000000..e69de29