production-taskbar / backend / taskbar / migrations / 0001_initial.py
0001_initial.py
Raw
# Generated by Django 3.2.7 on 2021-10-08 11:57

from django.conf import settings
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
import simple_history.models
import taskbar.models


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('links', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='ExclusiveProgram',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('executable_path', models.CharField(default='', max_length=200)),
                ('icon', models.ImageField(blank=True, default='', upload_to=taskbar.models.set_icon_filename)),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
            ],
            options={
                'verbose_name_plural': '5. Спеціальні програми',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='Location',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=12, unique=True)),
                ('description', models.CharField(blank=True, default='', max_length=30)),
                ('ip_adresses', models.CharField(blank=True, default='', help_text='Regex pattern for IP adresses for this location,                             used by client to detect his location', max_length=128)),
                ('password', models.CharField(help_text='Admin password to access admin features on frontend', max_length=8, validators=[django.core.validators.RegexValidator('^\\d+$', 'Only numbers, 8 max')])),
            ],
            options={
                'verbose_name_plural': '1. Філії',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='Program',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('executable_path', models.CharField(default='', max_length=200)),
                ('window_process', models.CharField(blank=True, default='', help_text='Specify the main window process name (e.g. program_name.exe) in case of launching via bat\\cmd.', max_length=200)),
                ('icon', models.ImageField(blank=True, default='', upload_to=taskbar.models.set_icon_filename)),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
            ],
            options={
                'verbose_name_plural': '3. Програми',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='Site',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('url', models.URLField()),
                ('icon', models.ImageField(blank=True, default='', upload_to=taskbar.models.set_icon_filename)),
                ('is_active', models.BooleanField(default=True)),
                ('is_program', models.BooleanField(default=False, help_text='Define if site is production web-application and must be placed in program section')),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
            ],
            options={
                'verbose_name_plural': '4. Виробничі веб-ресурси.',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='UtilitySoftware',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20, unique=True)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('executable_path', models.CharField(default='', max_length=200)),
                ('icon', models.ImageField(blank=True, default='', upload_to=taskbar.models.set_icon_filename)),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
            ],
            options={
                'verbose_name_plural': '6. Невиробничі програми-утіліти',
                'ordering': ['-id'],
            },
        ),
        migrations.CreateModel(
            name='WorkplaceType',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=12)),
                ('description', models.CharField(blank=True, default='', max_length=30)),
                ('is_active', models.BooleanField(default=True)),
                ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='taskbar.location')),
                ('programs', models.ManyToManyField(to='taskbar.Program')),
                ('sites', models.ManyToManyField(blank=True, to='taskbar.Site')),
                ('utility_software', models.ManyToManyField(blank=True, to='taskbar.UtilitySoftware')),
            ],
            options={
                'verbose_name_plural': '2. Типи робочих місць',
                'ordering': ['-id'],
                'unique_together': {('name', 'location')},
            },
        ),
        migrations.CreateModel(
            name='Workplace',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('hostname', models.CharField(max_length=18, unique=True)),
                ('description', models.CharField(blank=True, default='', max_length=30)),
                ('is_active', models.BooleanField(default=True)),
                ('last_seen', models.DateTimeField(blank=True, null=True)),
                ('exclusive_program', models.OneToOneField(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='taskbar.exclusiveprogram')),
                ('process', models.ManyToManyField(blank=True, to='links.Process')),
                ('sites', models.ManyToManyField(blank=True, to='taskbar.Site')),
                ('sources', models.ManyToManyField(blank=True, to='links.Source')),
                ('workplace_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='taskbar.workplacetype')),
            ],
            options={
                'verbose_name_plural': "7. Робочі місця (комп'ютери)",
                'ordering': ['-id'],
            },
        ),
        migrations.AddField(
            model_name='location',
            name='default_sites',
            field=models.ManyToManyField(blank=True, to='taskbar.Site', verbose_name='Default sites for all workplaces'),
        ),
        migrations.AddField(
            model_name='location',
            name='default_utility_software',
            field=models.ManyToManyField(blank=True, to='taskbar.UtilitySoftware', verbose_name='Default utility software for all workplaces'),
        ),
        migrations.CreateModel(
            name='HistoricalWorkplaceType',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('name', models.CharField(max_length=12)),
                ('description', models.CharField(blank=True, default='', max_length=30)),
                ('is_active', models.BooleanField(default=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('location', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='taskbar.location')),
            ],
            options={
                'verbose_name': 'historical workplace type',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalWorkplace',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('hostname', models.CharField(db_index=True, max_length=18)),
                ('description', models.CharField(blank=True, default='', max_length=30)),
                ('is_active', models.BooleanField(default=True)),
                ('last_seen', models.DateTimeField(blank=True, null=True)),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('exclusive_program', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='taskbar.exclusiveprogram')),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('workplace_type', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='taskbar.workplacetype')),
            ],
            options={
                'verbose_name': 'historical workplace',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalUtilitySoftware',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=20)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('executable_path', models.CharField(default='', max_length=200)),
                ('icon', models.TextField(blank=True, default='', max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical utility software',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalSite',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=20)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('url', models.URLField()),
                ('icon', models.TextField(blank=True, default='', max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('is_program', models.BooleanField(default=False, help_text='Define if site is production web-application and must be placed in program section')),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical site',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalProgram',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=20)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('executable_path', models.CharField(default='', max_length=200)),
                ('window_process', models.CharField(blank=True, default='', help_text='Specify the main window process name (e.g. program_name.exe) in case of launching via bat\\cmd.', max_length=200)),
                ('icon', models.TextField(blank=True, default='', max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical program',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalLocation',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=12)),
                ('description', models.CharField(blank=True, default='', max_length=30)),
                ('ip_adresses', models.CharField(blank=True, default='', help_text='Regex pattern for IP adresses for this location,                             used by client to detect his location', max_length=128)),
                ('password', models.CharField(help_text='Admin password to access admin features on frontend', max_length=8, validators=[django.core.validators.RegexValidator('^\\d+$', 'Only numbers, 8 max')])),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
            ],
            options={
                'verbose_name': 'historical location',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.CreateModel(
            name='HistoricalExclusiveProgram',
            fields=[
                ('id', models.BigIntegerField(auto_created=True, blank=True, db_index=True, verbose_name='ID')),
                ('name', models.CharField(db_index=True, max_length=20)),
                ('label', models.CharField(blank=True, help_text='If not empty used as name in frontend', max_length=20)),
                ('description', models.CharField(blank=True, default='', max_length=80)),
                ('executable_path', models.CharField(default='', max_length=200)),
                ('icon', models.TextField(blank=True, default='', max_length=100)),
                ('is_active', models.BooleanField(default=True)),
                ('order', models.IntegerField(default=10, help_text='Order reflected to frontend, less - first, same - autosorting', validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(20)])),
                ('history_id', models.AutoField(primary_key=True, serialize=False)),
                ('history_date', models.DateTimeField()),
                ('history_change_reason', models.CharField(max_length=100, null=True)),
                ('history_type', models.CharField(choices=[('+', 'Created'), ('~', 'Changed'), ('-', 'Deleted')], max_length=1)),
                ('history_user', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='+', to=settings.AUTH_USER_MODEL)),
                ('location', models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='taskbar.location')),
            ],
            options={
                'verbose_name': 'historical exclusive program',
                'ordering': ('-history_date', '-history_id'),
                'get_latest_by': 'history_date',
            },
            bases=(simple_history.models.HistoricalChanges, models.Model),
        ),
        migrations.AddField(
            model_name='exclusiveprogram',
            name='location',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='taskbar.location'),
        ),
        migrations.AlterUniqueTogether(
            name='exclusiveprogram',
            unique_together={('name', 'location')},
        ),
    ]