From 307f67c49a493210c4855cfcccc27f097f833328 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Fri, 24 Aug 2018 15:36:32 +0900 Subject: [PATCH] Add migration file --- app/server/migrations/0001_initial.py | 116 ++++++++++++++++++++++++++ 1 file changed, 116 insertions(+) create mode 100644 app/server/migrations/0001_initial.py diff --git a/app/server/migrations/0001_initial.py b/app/server/migrations/0001_initial.py new file mode 100644 index 00000000..8678ecff --- /dev/null +++ b/app/server/migrations/0001_initial.py @@ -0,0 +1,116 @@ +# Generated by Django 2.0.5 on 2018-08-09 02:09 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ] + + operations = [ + migrations.CreateModel( + name='Document', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.TextField()), + ], + ), + migrations.CreateModel( + name='DocumentAnnotation', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('prob', models.FloatField(default=0.0)), + ('manual', models.BooleanField(default=False)), + ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='doc_annotations', to='server.Document')), + ], + ), + migrations.CreateModel( + name='Label', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('text', models.CharField(max_length=100)), + ('shortcut', models.CharField(choices=[('a', 'a'), ('b', 'b'), ('c', 'c'), ('d', 'd'), ('e', 'e'), ('f', 'f'), ('g', 'g'), ('h', 'h'), ('i', 'i'), ('j', 'j'), ('k', 'k'), ('l', 'l'), ('m', 'm'), ('n', 'n'), ('o', 'o'), ('p', 'p'), ('q', 'q'), ('r', 'r'), ('s', 's'), ('t', 't'), ('u', 'u'), ('v', 'v'), ('w', 'w'), ('x', 'x'), ('y', 'y'), ('z', 'z')], max_length=10)), + ('background_color', models.CharField(default='#209cee', max_length=7)), + ('text_color', models.CharField(default='#ffffff', max_length=7)), + ], + ), + migrations.CreateModel( + name='Project', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=100)), + ('description', models.CharField(max_length=500)), + ('guideline', models.TextField()), + ('created_at', models.DateTimeField(auto_now_add=True)), + ('updated_at', models.DateTimeField(auto_now=True)), + ('project_type', models.CharField(choices=[('DocumentClassification', 'document classification'), ('SequenceLabeling', 'sequence labeling'), ('Seq2seq', 'sequence to sequence')], max_length=30)), + ('users', models.ManyToManyField(related_name='projects', to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='Seq2seqAnnotation', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('prob', models.FloatField(default=0.0)), + ('manual', models.BooleanField(default=False)), + ('text', models.TextField()), + ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seq2seq_annotations', to='server.Document')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.CreateModel( + name='SequenceAnnotation', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('prob', models.FloatField(default=0.0)), + ('manual', models.BooleanField(default=False)), + ('start_offset', models.IntegerField()), + ('end_offset', models.IntegerField()), + ('document', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='seq_annotations', to='server.Document')), + ('label', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='server.Label')), + ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)), + ], + ), + migrations.AddField( + model_name='label', + name='project', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='labels', to='server.Project'), + ), + migrations.AddField( + model_name='documentannotation', + name='label', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='server.Label'), + ), + migrations.AddField( + model_name='documentannotation', + name='user', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), + ), + migrations.AddField( + model_name='document', + name='project', + field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='documents', to='server.Project'), + ), + migrations.AlterUniqueTogether( + name='sequenceannotation', + unique_together={('document', 'user', 'label', 'start_offset', 'end_offset')}, + ), + migrations.AlterUniqueTogether( + name='seq2seqannotation', + unique_together={('document', 'user', 'text')}, + ), + migrations.AlterUniqueTogether( + name='label', + unique_together={('project', 'text'), ('project', 'shortcut')}, + ), + migrations.AlterUniqueTogether( + name='documentannotation', + unique_together={('document', 'user', 'label')}, + ), + ]