Performance Schema; bug 599129

This commit is contained in:
Wil Clouser 2010-10-06 16:25:19 -07:00
Родитель eb2bb1ef6a
Коммит 4acbbac109
2 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -879,3 +879,34 @@ class AddonLog(mongoengine.Document):
# the pieces in mongo (along with the context needed to format the log
# record).
pass
class PerformanceAppversions(amo.models.ModelBase):
"""Add-on performance appversions. This table is pretty much the same as
`appversions` but is separate because we need to push the perf stuff now
and I'm scared to mess with `appversions` because remora uses it in some
sensitive places. If we survive past 2012 and people suddenly have too
much time on their hands, consider merging the two."""
APP_CHOICES = [('fx', 'Firefox')]
app = models.CharField(max_length=255, choices=APP_CHOICES)
version = models.CharField(max_length=255, db_index=True)
class Meta:
db_table = 'perf_appversions'
class Performance(amo.models.ModelBase):
"""Add-on performance numbers. A bit denormalized."""
TEST_CHOICES = [('ts', 'Startup Time')]
addon = models.ForeignKey(Addon)
average = models.FloatField(default=0, db_index=True)
appversion = models.ForeignKey('PerformanceAppVersions')
os = models.CharField(max_length=255)
test = models.CharField(max_length=50, choices=TEST_CHOICES)
class Meta:
db_table = 'perf_results'

Просмотреть файл

@ -0,0 +1,24 @@
CREATE TABLE `perf_results` (
`id` int(11) unsigned NOT NULL auto_increment,
`addon_id` int(11) unsigned NOT NULL,
`appversion_id` int(11) unsigned NOT NULL,
`average` float NOT NULL default 0,
`os` varchar(255) NOT NULL default '',
`test` enum('ts'),
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
CREATE TABLE `perf_appversions` (
`id` int(11) unsigned NOT NULL auto_increment,
`app` enum('fx'),
`version` varchar(255) NOT NULL default '',
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
PRIMARY KEY (`id`)
) DEFAULT CHARSET=utf8;
ALTER TABLE `perf_results` ADD CONSTRAINT `perf_results_addon_id_key` FOREIGN KEY (`addon_id`) REFERENCES `addons` (`id`);
ALTER TABLE `perf_results` ADD CONSTRAINT `perf_results_appversion_key` FOREIGN KEY (`appversion_id`) REFERENCES `perf_appversions` (`id`);