Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Big int migration file has been rewritten with Python syntax #60

Merged
merged 1 commit into from
Sep 18, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 156 additions & 35 deletions cvat/apps/engine/migrations/0009_auto_20180917_1424.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,41 +9,162 @@ class Migration(migrations.Migration):
('engine', '0008_auto_20180917_1424'),
]

operations = [
migrations.RunSQL('ALTER TABLE "engine_objectpath" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_objectpathattributeval" ALTER COLUMN "track_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedbox" ALTER COLUMN "track_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpoints" ALTER COLUMN "track_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolygon" ALTER COLUMN "track_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolyline" ALTER COLUMN "track_id" TYPE bigint;'),

migrations.RunSQL('ALTER TABLE "engine_trackedbox" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpoints" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolygon" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolyline" ALTER COLUMN "id" TYPE bigint;'),

migrations.RunSQL('ALTER TABLE "engine_trackedboxattributeval" ALTER COLUMN "box_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpointsattributeval" ALTER COLUMN "points_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolygonattributeval" ALTER COLUMN "polygon_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolylineattributeval" ALTER COLUMN "polyline_id" TYPE bigint;'),

migrations.RunSQL('ALTER TABLE "engine_trackedboxattributeval" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpointsattributeval" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolygonattributeval" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_trackedpolylineattributeval" ALTER COLUMN "id" TYPE bigint;'),

migrations.RunSQL('ALTER TABLE "engine_labeledbox" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpoints" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpolygon" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpolyline" ALTER COLUMN "id" TYPE bigint;'),

migrations.RunSQL('ALTER TABLE "engine_labeledboxattributeval" ALTER COLUMN "box_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpointsattributeval" ALTER COLUMN "points_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpolygonattributeval" ALTER COLUMN "polygon_id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpolylineattributeval" ALTER COLUMN "polyline_id" TYPE bigint;'),

migrations.RunSQL('ALTER TABLE "engine_labeledboxattributeval" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpointsattributeval" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpolygonattributeval" ALTER COLUMN "id" TYPE bigint;'),
migrations.RunSQL('ALTER TABLE "engine_labeledpolylineattributeval" ALTER COLUMN "id" TYPE bigint;'),
operations = [
migrations.AlterField(
model_name='labeledbox',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledboxattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledpoints',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledpointsattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledpolygon',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledpolygonattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledpolyline',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='labeledpolylineattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='objectpath',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='objectpathattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedbox',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedboxattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedpoints',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedpointsattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedpolygon',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedpolygonattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedpolyline',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='trackedpolylineattributeval',
name='id',
field=models.BigAutoField(primary_key=True, serialize=False),
),
migrations.AlterField(
model_name='objectpathattributeval',
name='track_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='objectpathattributeval',
name='track_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedpoints',
name='track_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedpolygon',
name='track_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedpolyline',
name='track_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedboxattributeval',
name='box_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedpointsattributeval',
name='points_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedpolygonattributeval',
name='polygon_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='trackedpolylineattributeval',
name='polyline_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='labeledboxattributeval',
name='box_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='labeledpointsattributeval',
name='points_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='labeledpolygonattributeval',
name='polygon_id',
field=models.BigIntegerField(),
),
migrations.AlterField(
model_name='labeledpolylineattributeval',
name='polyline_id',
field=models.BigIntegerField(),
),
]
4 changes: 4 additions & 0 deletions cvat/apps/engine/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ def __str__(self):

class AttributeVal(models.Model):
# TODO: add a validator here to be sure that it corresponds to self.label
id = models.BigAutoField(primary_key=True)
spec = models.ForeignKey(AttributeSpec, on_delete=models.CASCADE)
value = models.CharField(max_length=64)
class Meta:
Expand All @@ -148,6 +149,7 @@ class Meta:
abstract = True

class BoundingBox(Shape):
id = models.BigAutoField(primary_key=True)
xtl = models.FloatField()
ytl = models.FloatField()
xbr = models.FloatField()
Expand All @@ -156,6 +158,7 @@ class Meta:
abstract = True

class PolyShape(Shape):
id = models.BigAutoField(primary_key=True)
points = models.TextField()
class Meta:
abstract = True
Expand Down Expand Up @@ -185,6 +188,7 @@ class LabeledPointsAttributeVal(AttributeVal):
points = models.ForeignKey(LabeledPoints, on_delete=models.CASCADE)

class ObjectPath(Annotation):
id = models.BigAutoField(primary_key=True)
shapes = models.CharField(max_length=10, default='boxes')

class ObjectPathAttributeVal(AttributeVal):
Expand Down