<gh_stars>0
# Generated by Django 3.0.8 on 2020-08-11 16:54

import business_logic.fields
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('contenttypes', '0002_remove_content_type_name'),
    ]

    operations = [
        migrations.CreateModel(
            name='Assignment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Assignment',
                'verbose_name_plural': 'Assignments',
            },
        ),
        migrations.CreateModel(
            name='BinaryOperator',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('operator', models.CharField(max_length=3, verbose_name='Operator')),
            ],
            options={
                'verbose_name': 'Binary operator',
                'verbose_name_plural': 'Binary operators',
            },
        ),
        migrations.CreateModel(
            name='BooleanConstant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.BooleanField(verbose_name='Value')),
            ],
            options={
                'verbose_name': 'Boolean constant',
                'verbose_name_plural': 'Boolean constants',
            },
        ),
        migrations.CreateModel(
            name='BreakLoop',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Break instruction',
                'verbose_name_plural': 'Break instructions',
            },
        ),
        migrations.CreateModel(
            name='DateConstant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.DateField(verbose_name='Value')),
            ],
            options={
                'verbose_name': 'Date constant',
                'verbose_name_plural': 'Date constants',
            },
        ),
        migrations.CreateModel(
            name='Execution',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('start_time', models.DateTimeField(auto_now_add=True)),
                ('finish_time', models.DateTimeField(null=True)),
            ],
            options={
                'ordering': ('-id',),
            },
        ),
        migrations.CreateModel(
            name='ExecutionEnvironment',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255, unique=True, verbose_name='Title')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Description')),
                ('debug', models.BooleanField(default=False)),
                ('log', models.BooleanField(default=False)),
                ('cache', models.BooleanField(default=True)),
                ('exception_handling_policy', models.CharField(choices=[('IGNORE', 'Ignore'), ('INTERRUPT', 'Interrupt'), ('RAISE', 'Raise')], default='INTERRUPT', max_length=15, verbose_name='Exception handling policy')),
            ],
        ),
        migrations.CreateModel(
            name='ForeachStatement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Foreach statement',
                'verbose_name_plural': 'Foreach statements',
            },
        ),
        migrations.CreateModel(
            name='FunctionArgument',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(blank=True, max_length=255, null=True)),
                ('description', models.TextField(blank=True, null=True, verbose_name='Description')),
                ('order', models.PositiveIntegerField(db_index=True, default=0)),
            ],
            options={
                'verbose_name': 'Function argument',
                'verbose_name_plural': 'Function arguments',
                'ordering': ('order',),
            },
        ),
        migrations.CreateModel(
            name='FunctionDefinition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255, unique=True, verbose_name='Title')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Description')),
                ('is_context_required', models.BooleanField(default=False, verbose_name='Is Context required')),
                ('is_returns_value', models.BooleanField(default=True, verbose_name='Is returns value')),
                ('polymorphic_ctype', models.ForeignKey(editable=False, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='polymorphic_business_logic.functiondefinition_set+', to='contenttypes.ContentType')),
            ],
            options={
                'abstract': False,
                'base_manager_name': 'objects',
            },
        ),
        migrations.CreateModel(
            name='IfStatement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'If statement',
                'verbose_name_plural': 'If statements',
            },
        ),
        migrations.CreateModel(
            name='Node',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('lft', models.PositiveIntegerField(db_index=True)),
                ('rgt', models.PositiveIntegerField(db_index=True)),
                ('tree_id', models.PositiveIntegerField(db_index=True)),
                ('depth', models.PositiveIntegerField(db_index=True)),
                ('object_id', models.PositiveIntegerField(null=True)),
                ('comment', models.CharField(blank=True, max_length=255, null=True, verbose_name='Comment')),
                ('content_type', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'verbose_name': 'Program node',
                'verbose_name_plural': 'Program nodes',
                'ordering': ['tree_id', 'lft'],
            },
        ),
        migrations.CreateModel(
            name='NumberConstant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.FloatField(verbose_name='Value')),
            ],
            options={
                'verbose_name': 'Float constant',
                'verbose_name_plural': 'Float constants',
            },
        ),
        migrations.CreateModel(
            name='Program',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255, verbose_name='Title')),
                ('code', models.SlugField(max_length=255, unique=True, verbose_name='Code')),
                ('creation_time', models.DateTimeField(auto_now_add=True)),
                ('modification_time', models.DateTimeField(auto_now=True)),
                ('environment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='business_logic.ExecutionEnvironment')),
            ],
            options={
                'verbose_name': 'Program',
                'verbose_name_plural': 'Programs',
                'ordering': ('id',),
            },
        ),
        migrations.CreateModel(
            name='ReferenceConstant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Reference constant',
                'verbose_name_plural': 'Reference constants',
            },
        ),
        migrations.CreateModel(
            name='StopInterpretation',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Stop instruction',
                'verbose_name_plural': 'Stop instructions',
            },
        ),
        migrations.CreateModel(
            name='StringConstant',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.TextField(default='', verbose_name='Value')),
            ],
            options={
                'verbose_name': 'String constant',
                'verbose_name_plural': 'String constants',
            },
        ),
        migrations.CreateModel(
            name='Table',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
            ],
            options={
                'verbose_name': 'Table',
                'verbose_name_plural': 'Tables',
            },
        ),
        migrations.CreateModel(
            name='UnaryOperator',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('operator', models.CharField(max_length=3, verbose_name='Operator')),
            ],
            options={
                'verbose_name': 'Unary operator',
                'verbose_name_plural': 'Unary operators',
            },
        ),
        migrations.CreateModel(
            name='VariableDefinition',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.TextField(verbose_name='Variable name')),
            ],
            options={
                'verbose_name': 'Variable definition',
                'verbose_name_plural': 'Variable definitions',
            },
        ),
        migrations.CreateModel(
            name='PythonCodeFunctionDefinition',
            fields=[
                ('functiondefinition_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='business_logic.FunctionDefinition')),
                ('code', models.TextField(max_length=255, verbose_name='Code')),
            ],
            options={
                'verbose_name': 'Python code function definition',
                'verbose_name_plural': 'Python code function definition',
            },
            bases=('business_logic.functiondefinition',),
        ),
        migrations.CreateModel(
            name='PythonModuleFunctionDefinition',
            fields=[
                ('functiondefinition_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=True, primary_key=True, serialize=False, to='business_logic.FunctionDefinition')),
                ('module', models.CharField(default='__builtins__', max_length=255, verbose_name='Module name')),
                ('function', models.CharField(max_length=255, verbose_name='Function name')),
            ],
            options={
                'verbose_name': 'Python module function definition',
                'verbose_name_plural': 'Python module function definition',
            },
            bases=('business_logic.functiondefinition',),
        ),
        migrations.CreateModel(
            name='Variable',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('definition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='variables', to='business_logic.VariableDefinition')),
            ],
            options={
                'verbose_name': 'Variable',
                'verbose_name_plural': 'Variables',
            },
        ),
        migrations.CreateModel(
            name='ReferenceDescriptor',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, max_length=255, null=True)),
                ('search_fields', models.TextField(blank=True, null=True)),
                ('name_field', models.SlugField(blank=True, max_length=255, null=True)),
                ('content_type', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
            ],
            options={
                'verbose_name': 'Reference descriptor',
                'verbose_name_plural': 'Reference descriptors',
            },
        ),
        migrations.CreateModel(
            name='ProgramVersion',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(blank=True, max_length=255, null=True, verbose_name='Title')),
                ('description', models.TextField(blank=True, null=True, verbose_name='Description')),
                ('is_default', models.BooleanField(default=False, verbose_name='Is default')),
                ('creation_time', models.DateTimeField(auto_now_add=True)),
                ('modification_time', models.DateTimeField(auto_now=True)),
                ('entry_point', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='business_logic.Node', verbose_name='Entry point')),
                ('environment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='business_logic.ExecutionEnvironment')),
                ('program', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='versions', to='business_logic.Program')),
            ],
            options={
                'verbose_name': 'Program version',
                'verbose_name_plural': 'Program versions',
                'ordering': ('id',),
            },
        ),
        migrations.CreateModel(
            name='ProgramInterface',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(db_index=True, max_length=255, verbose_name='Title')),
                ('code', models.SlugField(blank=True, max_length=255, null=True, unique=True, verbose_name='Code')),
                ('creation_time', models.DateTimeField(auto_now_add=True)),
                ('modification_time', models.DateTimeField(auto_now=True)),
                ('environment', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='business_logic.ExecutionEnvironment')),
            ],
            options={
                'verbose_name': 'Program interface',
                'verbose_name_plural': 'Program interfaces',
                'ordering': ('id',),
            },
        ),
        migrations.CreateModel(
            name='ProgramArgument',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.SlugField(max_length=255, verbose_name='Name')),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('program_interface', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='arguments', to='business_logic.ProgramInterface')),
                ('variable_definition', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='program_argument', to='business_logic.VariableDefinition')),
            ],
            options={
                'verbose_name': 'Program argument',
                'verbose_name_plural': 'Program arguments',
                'unique_together': {('program_interface', 'name')},
            },
        ),
        migrations.AddField(
            model_name='program',
            name='program_interface',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='programs', to='business_logic.ProgramInterface'),
        ),
        migrations.CreateModel(
            name='LogEntry',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('sib_order', models.PositiveIntegerField()),
                ('previous_value', models.CharField(max_length=255, verbose_name='Previous value')),
                ('current_value', models.CharField(max_length=255, verbose_name='Current value')),
                ('node', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='business_logic.Node', verbose_name='Program node')),
                ('parent', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='children', to='business_logic.LogEntry')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='FunctionLibrary',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('title', models.CharField(max_length=255, unique=True, verbose_name='Function library title')),
                ('functions', models.ManyToManyField(related_name='libraries', to='business_logic.FunctionDefinition')),
            ],
            options={
                'verbose_name': 'Function library',
                'verbose_name_plural': 'Function libraries',
            },
        ),
        migrations.CreateModel(
            name='FunctionArgumentChoice',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.CharField(max_length=255)),
                ('title', models.CharField(max_length=255)),
                ('order', models.PositiveIntegerField(db_index=True, default=0)),
                ('argument', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='choices', to='business_logic.FunctionArgument')),
            ],
            options={
                'verbose_name': 'Function argument choice',
                'verbose_name_plural': 'Function argument choices',
                'ordering': ('order',),
            },
        ),
        migrations.AddField(
            model_name='functionargument',
            name='function',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='arguments', to='business_logic.FunctionDefinition'),
        ),
        migrations.CreateModel(
            name='Function',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('definition', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='functions', to='business_logic.FunctionDefinition')),
            ],
            options={
                'verbose_name': 'Function',
                'verbose_name_plural': 'Functions',
            },
        ),
        migrations.AddField(
            model_name='executionenvironment',
            name='libraries',
            field=models.ManyToManyField(blank=True, related_name='environments', to='business_logic.FunctionLibrary'),
        ),
        migrations.CreateModel(
            name='ExecutionArgument',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('object_id', models.PositiveIntegerField()),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.ContentType')),
                ('execution', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='arguments', to='business_logic.Execution')),
                ('program_argument', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='business_logic.ProgramArgument')),
            ],
        ),
        migrations.AddField(
            model_name='execution',
            name='log',
            field=models.OneToOneField(null=True, on_delete=django.db.models.deletion.SET_NULL, to='business_logic.LogEntry'),
        ),
        migrations.AddField(
            model_name='execution',
            name='program_version',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='business_logic.ProgramVersion'),
        ),
        migrations.CreateModel(
            name='ExceptionLog',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('module', models.CharField(max_length=255)),
                ('type', models.CharField(max_length=255)),
                ('message', models.CharField(max_length=512)),
                ('traceback', models.TextField()),
                ('log_entry', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='exception', to='business_logic.LogEntry')),
            ],
        ),
        migrations.CreateModel(
            name='ProgramArgumentField',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', business_logic.fields.DeepAttributeField(max_length=255, verbose_name='Name')),
                ('title', models.CharField(blank=True, max_length=255, null=True, verbose_name='Title')),
                ('program_argument', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='fields', to='business_logic.ProgramArgument')),
                ('variable_definition', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='program_argument_field', to='business_logic.VariableDefinition')),
            ],
            options={
                'verbose_name': 'Program argument field',
                'verbose_name_plural': 'Program argument fields',
                'ordering': ('name',),
                'unique_together': {('program_argument', 'name')},
            },
        ),
    ]
