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.
This commit is contained in:
parent
710fd7df01
commit
6521204608
5 changed files with 173 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,7 +1,6 @@
|
|||
__pycache__/
|
||||
*.pyc
|
||||
db.sqlite3
|
||||
migrations/
|
||||
venv/
|
||||
localsettings.py
|
||||
settings.ini
|
54
gpslog/migrations/0001_initial.py
Normal file
54
gpslog/migrations/0001_initial.py
Normal file
|
@ -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')),
|
||||
],
|
||||
),
|
||||
]
|
0
gpslog/migrations/__init__.py
Normal file
0
gpslog/migrations/__init__.py
Normal file
119
mood/migrations/0001_initial.py
Normal file
119
mood/migrations/0001_initial.py
Normal file
|
@ -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')),
|
||||
],
|
||||
),
|
||||
]
|
0
mood/migrations/__init__.py
Normal file
0
mood/migrations/__init__.py
Normal file
Loading…
Reference in a new issue