Skip to content

Commit 967e044

Browse files
mitsuhikomattrobenolt
authored andcommitted
Merge pull request #3174 from getsentry/bugfix/mysql-object-path-index
Restrict the object_path index length for mysql
1 parent bb1a339 commit 967e044

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/sentry/migrations/0246_auto__add_dsymsymbol__add_unique_dsymsymbol_object_address__add_dsymsd.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from south.db import db
44
from south.v2 import SchemaMigration
55
from django.db import models
6+
from sentry.utils.db import is_mysql
67

78

89
class Migration(SchemaMigration):
@@ -39,11 +40,22 @@ def forwards(self, orm):
3940
db.create_table('sentry_dsymobject', (
4041
('id', self.gf('sentry.db.models.fields.bounded.BoundedBigAutoField')(primary_key=True)),
4142
('cpu_name', self.gf('django.db.models.fields.CharField')(max_length=40)),
42-
('object_path', self.gf('django.db.models.fields.TextField')(db_index=True)),
43+
('object_path', self.gf('django.db.models.fields.TextField')(db_index=not is_mysql())),
4344
('uuid', self.gf('django.db.models.fields.CharField')(max_length=36, db_index=True)),
4445
('vmaddr', self.gf('sentry.db.models.fields.bounded.BoundedBigIntegerField')(null=True)),
4546
('vmsize', self.gf('sentry.db.models.fields.bounded.BoundedBigIntegerField')(null=True)),
4647
))
48+
49+
# On MySQL we need to create the index here differently because
50+
# the index must have a limit. As we have the type already
51+
# defined to text in the model earlier we just restrict the index
52+
# to 255. The hash matches what south would have created.
53+
if is_mysql():
54+
db.execute('''
55+
create index sentry_dsymobject_39c06cbd
56+
on sentry_dsymobject (object_path(255))
57+
''')
58+
4759
db.send_create_signal('sentry', ['DSymObject'])
4860

4961
# Adding model 'DSymBundle'
@@ -627,4 +639,4 @@ def backwards(self, orm):
627639
}
628640
}
629641

630-
complete_apps = ['sentry']
642+
complete_apps = ['sentry']

0 commit comments

Comments
 (0)