You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
6.2 KiB

  1. # Generated by Django 3.2.11 on 2022-01-27 00:32
  2. from django.conf import settings
  3. from django.db import migrations, models
  4. import django.db.models.deletion
  5. import django.db.models.expressions
  6. class Migration(migrations.Migration):
  7. initial = True
  8. dependencies = [
  9. migrations.swappable_dependency(settings.AUTH_USER_MODEL),
  10. ('api', '0031_auto_20220127_0032'),
  11. ]
  12. operations = [
  13. migrations.SeparateDatabaseAndState(
  14. state_operations=[
  15. migrations.CreateModel(
  16. name='Span',
  17. fields=[
  18. ('id',
  19. models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  20. ('prob', models.FloatField(default=0.0)),
  21. ('manual', models.BooleanField(default=False)),
  22. ('created_at', models.DateTimeField(auto_now_add=True)),
  23. ('updated_at', models.DateTimeField(auto_now=True)),
  24. ('start_offset', models.IntegerField()),
  25. ('end_offset', models.IntegerField()),
  26. ('example', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='spans',
  27. to='api.example')),
  28. ('label', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.spantype')),
  29. ('user',
  30. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  31. ],
  32. ),
  33. migrations.CreateModel(
  34. name='Category',
  35. fields=[
  36. ('id',
  37. models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  38. ('prob', models.FloatField(default=0.0)),
  39. ('manual', models.BooleanField(default=False)),
  40. ('created_at', models.DateTimeField(auto_now_add=True)),
  41. ('updated_at', models.DateTimeField(auto_now=True)),
  42. ('example',
  43. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='categories',
  44. to='api.example')),
  45. (
  46. 'label', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.categorytype')),
  47. ('user',
  48. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  49. ],
  50. ),
  51. migrations.CreateModel(
  52. name='AnnotationRelations',
  53. fields=[
  54. ('id',
  55. models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  56. ('annotation_id_1', models.IntegerField()),
  57. ('annotation_id_2', models.IntegerField()),
  58. ('timestamp', models.DateTimeField()),
  59. ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
  60. related_name='annotation_relations', to='api.project')),
  61. ('type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
  62. related_name='annotation_relations', to='api.relationtypes')),
  63. ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE,
  64. related_name='annotation_relations', to=settings.AUTH_USER_MODEL)),
  65. ],
  66. ),
  67. migrations.CreateModel(
  68. name='TextLabel',
  69. fields=[
  70. ('id',
  71. models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
  72. ('prob', models.FloatField(default=0.0)),
  73. ('manual', models.BooleanField(default=False)),
  74. ('created_at', models.DateTimeField(auto_now_add=True)),
  75. ('updated_at', models.DateTimeField(auto_now=True)),
  76. ('text', models.TextField()),
  77. ('example', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='texts',
  78. to='api.example')),
  79. ('user',
  80. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
  81. ],
  82. options={
  83. 'unique_together': {('example', 'user', 'text')},
  84. },
  85. ),
  86. migrations.AddConstraint(
  87. model_name='span',
  88. constraint=models.CheckConstraint(check=models.Q(('start_offset__gte', 0)),
  89. name='startOffset >= 0'),
  90. ),
  91. migrations.AddConstraint(
  92. model_name='span',
  93. constraint=models.CheckConstraint(check=models.Q(('end_offset__gte', 0)), name='endOffset >= 0'),
  94. ),
  95. migrations.AddConstraint(
  96. model_name='span',
  97. constraint=models.CheckConstraint(
  98. check=models.Q(('start_offset__lt', django.db.models.expressions.F('end_offset'))),
  99. name='start < end'),
  100. ),
  101. migrations.AlterUniqueTogether(
  102. name='category',
  103. unique_together={('example', 'user', 'label')},
  104. ),
  105. migrations.AlterUniqueTogether(
  106. name='annotationrelations',
  107. unique_together={('annotation_id_1', 'annotation_id_2', 'type', 'project')},
  108. ),
  109. ],
  110. database_operations=[]
  111. )
  112. ]