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.

173 lines
7.6 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  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. (
  19. "id",
  20. models.BigAutoField(
  21. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  22. ),
  23. ),
  24. ("prob", models.FloatField(default=0.0)),
  25. ("manual", models.BooleanField(default=False)),
  26. ("created_at", models.DateTimeField(auto_now_add=True)),
  27. ("updated_at", models.DateTimeField(auto_now=True)),
  28. ("start_offset", models.IntegerField()),
  29. ("end_offset", models.IntegerField()),
  30. (
  31. "example",
  32. models.ForeignKey(
  33. on_delete=django.db.models.deletion.CASCADE, related_name="spans", to="api.example"
  34. ),
  35. ),
  36. ("label", models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.spantype")),
  37. (
  38. "user",
  39. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  40. ),
  41. ],
  42. ),
  43. migrations.CreateModel(
  44. name="Category",
  45. fields=[
  46. (
  47. "id",
  48. models.BigAutoField(
  49. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  50. ),
  51. ),
  52. ("prob", models.FloatField(default=0.0)),
  53. ("manual", models.BooleanField(default=False)),
  54. ("created_at", models.DateTimeField(auto_now_add=True)),
  55. ("updated_at", models.DateTimeField(auto_now=True)),
  56. (
  57. "example",
  58. models.ForeignKey(
  59. on_delete=django.db.models.deletion.CASCADE, related_name="categories", to="api.example"
  60. ),
  61. ),
  62. (
  63. "label",
  64. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to="api.categorytype"),
  65. ),
  66. (
  67. "user",
  68. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  69. ),
  70. ],
  71. ),
  72. migrations.CreateModel(
  73. name="AnnotationRelations",
  74. fields=[
  75. (
  76. "id",
  77. models.BigAutoField(
  78. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  79. ),
  80. ),
  81. ("annotation_id_1", models.IntegerField()),
  82. ("annotation_id_2", models.IntegerField()),
  83. ("timestamp", models.DateTimeField()),
  84. (
  85. "project",
  86. models.ForeignKey(
  87. on_delete=django.db.models.deletion.CASCADE,
  88. related_name="annotation_relations",
  89. to="api.project",
  90. ),
  91. ),
  92. (
  93. "type",
  94. models.ForeignKey(
  95. on_delete=django.db.models.deletion.CASCADE,
  96. related_name="annotation_relations",
  97. to="api.relationtypes",
  98. ),
  99. ),
  100. (
  101. "user",
  102. models.ForeignKey(
  103. on_delete=django.db.models.deletion.CASCADE,
  104. related_name="annotation_relations",
  105. to=settings.AUTH_USER_MODEL,
  106. ),
  107. ),
  108. ],
  109. ),
  110. migrations.CreateModel(
  111. name="TextLabel",
  112. fields=[
  113. (
  114. "id",
  115. models.BigAutoField(
  116. auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
  117. ),
  118. ),
  119. ("prob", models.FloatField(default=0.0)),
  120. ("manual", models.BooleanField(default=False)),
  121. ("created_at", models.DateTimeField(auto_now_add=True)),
  122. ("updated_at", models.DateTimeField(auto_now=True)),
  123. ("text", models.TextField()),
  124. (
  125. "example",
  126. models.ForeignKey(
  127. on_delete=django.db.models.deletion.CASCADE, related_name="texts", to="api.example"
  128. ),
  129. ),
  130. (
  131. "user",
  132. models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
  133. ),
  134. ],
  135. options={
  136. "unique_together": {("example", "user", "text")},
  137. },
  138. ),
  139. migrations.AddConstraint(
  140. model_name="span",
  141. constraint=models.CheckConstraint(
  142. check=models.Q(("start_offset__gte", 0)), name="startOffset >= 0"
  143. ),
  144. ),
  145. migrations.AddConstraint(
  146. model_name="span",
  147. constraint=models.CheckConstraint(check=models.Q(("end_offset__gte", 0)), name="endOffset >= 0"),
  148. ),
  149. migrations.AddConstraint(
  150. model_name="span",
  151. constraint=models.CheckConstraint(
  152. check=models.Q(("start_offset__lt", django.db.models.expressions.F("end_offset"))),
  153. name="start < end",
  154. ),
  155. ),
  156. migrations.AlterUniqueTogether(
  157. name="category",
  158. unique_together={("example", "user", "label")},
  159. ),
  160. migrations.AlterUniqueTogether(
  161. name="annotationrelations",
  162. unique_together={("annotation_id_1", "annotation_id_2", "type", "project")},
  163. ),
  164. ],
  165. database_operations=[],
  166. )
  167. ]