# -*- coding: utf-8 -*-
# Generated by Django 1.11.6 on 2017-10-16 04:02
from __future__ import unicode_literals

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='Job',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('ci_id', models.CharField(help_text='Jenkins job ID', max_length=16)),
                ('ci_name', models.CharField(help_text='Name of the Jenkins project,e.g. validate_drp', max_length=32)),
                ('ci_dataset', models.CharField(help_text='Name of the dataset, e.g cfht', max_length=16)),
                ('ci_label', models.CharField(help_text='Name of the platform, eg. centos-7', max_length=16)),
                ('date', models.DateTimeField(auto_now=True, help_text='Datetime when job was registered')),
                ('ci_url', models.URLField(help_text='Jenkins job URL')),
                ('status', models.SmallIntegerField(default=0, help_text='Job status, 0=OK, 1=Failed')),
                ('blobs', json_field.fields.JSONField(blank=True, default=None, help_text='Data blobs produced by the job.', null=True)),
            ],
        ),
        migrations.CreateModel(
            name='Measurement',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('value', models.FloatField(help_text='Metric scalar measurement')),
                ('metadata', json_field.fields.JSONField(blank=True, default=None, help_text='Measurement metadata', null=True)),
                ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Job')),
            ],
        ),
        migrations.CreateModel(
            name='Metric',
            fields=[
                ('metric', models.CharField(help_text='Metric name', max_length=16, primary_key=True, serialize=False)),
                ('unit', models.CharField(blank=True, default='', help_text='Metric unit, astropy compatible string', max_length=16, null=True)),
                ('description', models.TextField(help_text='Metric description')),
                ('operator', models.CharField(default='<', help_text='Operator used to test measurementvalue against metric specification', max_length=2)),
                ('parameters', json_field.fields.JSONField(blank=True, default=None, help_text='Parameters used to define the metric', null=True)),
                ('specs', json_field.fields.JSONField(blank=True, default=None, help_text='Array of metric specification', null=True)),
                ('reference', json_field.fields.JSONField(blank=True, default=None, help_text='Metric reference', null=True)),
            ],
        ),
        migrations.CreateModel(
            name='VersionedPackage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.SlugField(help_text='EUPS package name', max_length=64)),
                ('git_url', models.URLField(help_text='Git repo URL for package', max_length=128)),
                ('git_commit', models.CharField(help_text='SHA1 hash of the git commit', max_length=40)),
                ('git_branch', models.TextField(help_text='Resolved git branch that the commit resides on')),
                ('build_version', models.TextField(help_text='EUPS build version')),
                ('job', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='packages', to='api.Job')),
            ],
        ),
        migrations.AddField(
            model_name='measurement',
            name='metric',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='measurements', to='api.Metric'),
        ),
    ]
