# Generated by Django 3.1.2 on 2020-10-30 22:39

from django.contrib.postgres.operations import CreateExtension
import django.contrib.gis.db.models.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('workplace', '0001_initial'),
    ]

    operations = [
        CreateExtension('postgis'),
        migrations.CreateModel(
            name='Session',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('started_at', models.DateTimeField()),
                ('ended_at', models.DateTimeField(null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Specialization',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=255)),
            ],
        ),
        migrations.CreateModel(
            name='Worker',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('first_name', models.CharField(max_length=255)),
                ('last_name', models.CharField(max_length=255)),
                ('phone', models.CharField(max_length=15, unique=True)),
                ('is_approved', models.BooleanField(default=False)),
                ('specialization', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='worker.specialization')),
            ],
        ),
        migrations.CreateModel(
            name='Tracking',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('gps', django.contrib.gis.db.models.fields.PointField(srid=4326)),
                ('noise_level', models.FloatField(null=True)),
                ('light_level', models.FloatField(null=True)),
                ('acceleration', models.JSONField(null=True)),
                ('created_at', models.DateTimeField()),
                ('session', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='worker.session')),
                ('worker', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='worker.worker')),
            ],
        ),
        migrations.AddField(
            model_name='session',
            name='worker',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='worker.worker'),
        ),
        migrations.AddField(
            model_name='session',
            name='workplace',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to='workplace.workplace', related_name='sessions'),
        ),
        migrations.AddField(
            model_name='session',
            name='zone',
            field=models.ForeignKey(default=None, null=True, on_delete=django.db.models.deletion.PROTECT, to='workplace.zone'),
        ),
    ]
