# Generated by Django 2.0.2 on 2018-02-20 15:11

import django.contrib.postgres.fields
import django.contrib.postgres.fields.hstore
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='GroupworkspaceQuota',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('workspace', models.CharField(max_length=1024)),
            ],
        ),
        migrations.CreateModel(
            name='Migration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('stage', models.IntegerField(choices=[(0, 'ON_DISK'), (1, 'PUT_PENDING'), (2, 'PUTTING'), (3, 'VERIFY_PENDING'), (4, 'VERIFY_GETTING'), (5, 'VERIFYING'), (6, 'ON_STORAGE'), (7, 'FAILED')], default=7)),
                ('external_id', models.IntegerField(blank=True, help_text='Batch id for external backup system, e.g. elastic tape or object store', null=True)),
                ('label', models.CharField(blank=True, help_text='Human readable label for request', max_length=1024, null=True)),
                ('registered_date', models.DateTimeField(blank=True, help_text='Date the request was registered with the JDMA', null=True)),
                ('filelist', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=1024, unique=True), blank=True, help_text='List of files for uploading or downloading', null=True, size=None)),
                ('storage', models.CharField(default='elastictape', help_text='External storage location of the migration, e.g. elastictape or objectstore', max_length=256)),
                ('failure_reason', models.CharField(blank=True, help_text='Reason for failure of request', max_length=1024, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='MigrationFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('path', models.CharField(help_text='Absolute path to the file', max_length=1024)),
                ('digest', models.CharField(help_text='SHA-256 digest of the file', max_length=64)),
                ('unix_user_id', models.CharField(blank=True, help_text='uid of original owner of directory', max_length=256, null=True)),
                ('unix_group_id', models.CharField(blank=True, help_text='gid of original owner of directory', max_length=256, null=True)),
                ('unix_permission', models.IntegerField(blank=True, help_text='File permissions of original directory', null=True)),
            ],
        ),
        migrations.CreateModel(
            name='MigrationRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('request_type', models.IntegerField(choices=[(0, 'PUT'), (1, 'GET'), (2, 'MIGRATE')])),
                ('stage', models.IntegerField(choices=[(0, 'ON_STORAGE'), (1, 'GET_PENDING'), (2, 'GETTING'), (3, 'ON_DISK'), (4, 'FAILED')], default=0)),
                ('date', models.DateTimeField(blank=True, help_text='Date the request was registered with the JDMA', null=True)),
                ('target_path', models.CharField(blank=True, help_text='Target directory path', max_length=1024, null=True)),
                ('storage', models.CharField(default='elastictape', help_text='External storage location of the migration, e.g. elastictape or objectstore', max_length=256)),
                ('credentials', django.contrib.postgres.fields.hstore.HStoreField(blank=True, help_text='Credentials required to access the external storage (encrypted)', null=True)),
                ('failure_reason', models.CharField(blank=True, help_text='Reason for failure of request', max_length=1024, null=True)),
                ('migration', models.ForeignKey(help_text='Migration associated with this MigrationRequest', null=True, on_delete=django.db.models.deletion.CASCADE, to='jdma_control.Migration')),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of user - should be same as JASMIN user name', max_length=256)),
                ('email', models.EmailField(help_text='Email of user', max_length=256)),
                ('notify', models.BooleanField(default=True, help_text='Switch notifications on / off')),
            ],
        ),
        migrations.AddField(
            model_name='migrationrequest',
            name='user',
            field=models.ForeignKey(help_text='User that the request belongs to', on_delete=django.db.models.deletion.CASCADE, to='jdma_control.User'),
        ),
        migrations.AddField(
            model_name='migration',
            name='user',
            field=models.ForeignKey(help_text='User that the directory belongs to', on_delete=django.db.models.deletion.CASCADE, to='jdma_control.User'),
        ),
        migrations.AddField(
            model_name='migration',
            name='workspace',
            field=models.ForeignKey(help_text='Workspace used for this request', on_delete=django.db.models.deletion.CASCADE, to='jdma_control.GroupworkspaceQuota'),
        ),
    ]

# Generated by Django 2.0.2 on 2018-02-20 15:11

import django.contrib.postgres.fields
import django.contrib.postgres.fields.hstore
from django.db import migrations, models
import django.db.models.deletion


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='GroupworkspaceQuota',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('workspace', models.CharField(max_length=1024)),
            ],
        ),
        migrations.CreateModel(
            name='Migration',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('stage', models.IntegerField(choices=[(0, 'ON_DISK'), (1, 'PUT_PENDING'), (2, 'PUTTING'), (3, 'VERIFY_PENDING'), (4, 'VERIFY_GETTING'), (5, 'VERIFYING'), (6, 'ON_STORAGE'), (7, 'FAILED')], default=7)),
                ('external_id', models.IntegerField(blank=True, help_text='Batch id for external backup system, e.g. elastic tape or object store', null=True)),
                ('label', models.CharField(blank=True, help_text='Human readable label for request', max_length=1024, null=True)),
                ('registered_date', models.DateTimeField(blank=True, help_text='Date the request was registered with the JDMA', null=True)),
                ('filelist', django.contrib.postgres.fields.ArrayField(base_field=models.CharField(blank=True, max_length=1024, unique=True), blank=True, help_text='List of files for uploading or downloading', null=True, size=None)),
                ('storage', models.CharField(default='elastictape', help_text='External storage location of the migration, e.g. elastictape or objectstore', max_length=256)),
                ('failure_reason', models.CharField(blank=True, help_text='Reason for failure of request', max_length=1024, null=True)),
            ],
        ),
        migrations.CreateModel(
            name='MigrationFile',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('path', models.CharField(help_text='Absolute path to the file', max_length=1024)),
                ('digest', models.CharField(help_text='SHA-256 digest of the file', max_length=64)),
                ('unix_user_id', models.CharField(blank=True, help_text='uid of original owner of directory', max_length=256, null=True)),
                ('unix_group_id', models.CharField(blank=True, help_text='gid of original owner of directory', max_length=256, null=True)),
                ('unix_permission', models.IntegerField(blank=True, help_text='File permissions of original directory', null=True)),
            ],
        ),
        migrations.CreateModel(
            name='MigrationRequest',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('request_type', models.IntegerField(choices=[(0, 'PUT'), (1, 'GET'), (2, 'MIGRATE')])),
                ('stage', models.IntegerField(choices=[(0, 'ON_STORAGE'), (1, 'GET_PENDING'), (2, 'GETTING'), (3, 'ON_DISK'), (4, 'FAILED')], default=0)),
                ('date', models.DateTimeField(blank=True, help_text='Date the request was registered with the JDMA', null=True)),
                ('target_path', models.CharField(blank=True, help_text='Target directory path', max_length=1024, null=True)),
                ('storage', models.CharField(default='elastictape', help_text='External storage location of the migration, e.g. elastictape or objectstore', max_length=256)),
                ('credentials', django.contrib.postgres.fields.hstore.HStoreField(blank=True, help_text='Credentials required to access the external storage (encrypted)', null=True)),
                ('failure_reason', models.CharField(blank=True, help_text='Reason for failure of request', max_length=1024, null=True)),
                ('migration', models.ForeignKey(help_text='Migration associated with this MigrationRequest', null=True, on_delete=django.db.models.deletion.CASCADE, to='jdma_control.Migration')),
            ],
        ),
        migrations.CreateModel(
            name='User',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(help_text='Name of user - should be same as JASMIN user name', max_length=256)),
                ('email', models.EmailField(help_text='Email of user', max_length=256)),
                ('notify', models.BooleanField(default=True, help_text='Switch notifications on / off')),
            ],
        ),
        migrations.AddField(
            model_name='migrationrequest',
            name='user',
            field=models.ForeignKey(help_text='User that the request belongs to', on_delete=django.db.models.deletion.CASCADE, to='jdma_control.User'),
        ),
        migrations.AddField(
            model_name='migration',
            name='user',
            field=models.ForeignKey(help_text='User that the directory belongs to', on_delete=django.db.models.deletion.CASCADE, to='jdma_control.User'),
        ),
        migrations.AddField(
            model_name='migration',
            name='workspace',
            field=models.ForeignKey(help_text='Workspace used for this request', on_delete=django.db.models.deletion.CASCADE, to='jdma_control.GroupworkspaceQuota'),
        ),
    ]

# Generated by Django 2.0.2 on 2018-02-20 15:11