mirror of https://github.com/doccano/doccano.git
Hironsan
2 years ago
5 changed files with 163 additions and 0 deletions
Split View
Diff Options
-
66backend/data_export/migrations/0001_initial.py
-
34backend/labels/migrations/0012_add_uuid_field.py
-
27backend/labels/migrations/0013_populate_uuid_values.py
-
33backend/labels/migrations/0014_remove_uuid_null.py
-
3backend/labels/models.py
@ -0,0 +1,66 @@ |
|||
# Generated by Django 4.0.2 on 2022-05-12 02:27 |
|||
|
|||
from django.db import migrations |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
initial = True |
|||
|
|||
dependencies = [ |
|||
("examples", "0006_alter_example_upload_name"), |
|||
("labels", "0012_add_uuid_field"), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.CreateModel( |
|||
name="ExportedCategory", |
|||
fields=[], |
|||
options={ |
|||
"proxy": True, |
|||
"indexes": [], |
|||
"constraints": [], |
|||
}, |
|||
bases=("labels.category",), |
|||
), |
|||
migrations.CreateModel( |
|||
name="ExportedExample", |
|||
fields=[], |
|||
options={ |
|||
"proxy": True, |
|||
"indexes": [], |
|||
"constraints": [], |
|||
}, |
|||
bases=("examples.example",), |
|||
), |
|||
migrations.CreateModel( |
|||
name="ExportedRelation", |
|||
fields=[], |
|||
options={ |
|||
"proxy": True, |
|||
"indexes": [], |
|||
"constraints": [], |
|||
}, |
|||
bases=("labels.relation",), |
|||
), |
|||
migrations.CreateModel( |
|||
name="ExportedSpan", |
|||
fields=[], |
|||
options={ |
|||
"proxy": True, |
|||
"indexes": [], |
|||
"constraints": [], |
|||
}, |
|||
bases=("labels.span",), |
|||
), |
|||
migrations.CreateModel( |
|||
name="ExportedText", |
|||
fields=[], |
|||
options={ |
|||
"proxy": True, |
|||
"indexes": [], |
|||
"constraints": [], |
|||
}, |
|||
bases=("labels.textlabel",), |
|||
), |
|||
] |
@ -0,0 +1,34 @@ |
|||
# Generated by Django 4.0.2 on 2022-05-12 02:27 |
|||
|
|||
from django.db import migrations, models |
|||
import uuid |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
("labels", "0011_remove_relation_direction"), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AddField( |
|||
model_name="category", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, null=True), |
|||
), |
|||
migrations.AddField( |
|||
model_name="relation", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, null=True), |
|||
), |
|||
migrations.AddField( |
|||
model_name="span", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, null=True), |
|||
), |
|||
migrations.AddField( |
|||
model_name="textlabel", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, null=True), |
|||
), |
|||
] |
@ -0,0 +1,27 @@ |
|||
# Generated by Django 4.0.2 on 2022-05-12 02:28 |
|||
|
|||
from django.db import migrations |
|||
|
|||
import uuid |
|||
|
|||
|
|||
def gen_uuid(apps, schema_editor): |
|||
Category = apps.get_model("labels", "Category") |
|||
Span = apps.get_model("labels", "Span") |
|||
Relation = apps.get_model("labels", "Relation") |
|||
TextLabel = apps.get_model("labels", "TextLabel") |
|||
for label in [Category, Span, Relation, TextLabel]: |
|||
for row in label.objects.all(): |
|||
row.uuid = uuid.uuid4() |
|||
row.save(update_fields=["uuid"]) |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
("labels", "0012_add_uuid_field"), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.RunPython(gen_uuid, reverse_code=migrations.RunPython.noop), |
|||
] |
@ -0,0 +1,33 @@ |
|||
import uuid |
|||
|
|||
from django.db import migrations, models |
|||
|
|||
|
|||
class Migration(migrations.Migration): |
|||
|
|||
dependencies = [ |
|||
("labels", "0013_populate_uuid_values"), |
|||
] |
|||
|
|||
operations = [ |
|||
migrations.AlterField( |
|||
model_name="category", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, unique=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name="relation", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, unique=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name="span", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, unique=True), |
|||
), |
|||
migrations.AlterField( |
|||
model_name="textlabel", |
|||
name="uuid", |
|||
field=models.UUIDField(default=uuid.uuid4, unique=True), |
|||
), |
|||
] |
Write
Preview
Loading…
Cancel
Save