adding a table for blocklist details

This commit is contained in:
Jeff Balogh 2011-03-16 15:23:50 -07:00
Родитель dabfbb809b
Коммит 2514da423c
2 изменённых файлов: 39 добавлений и 0 удалений

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

@ -22,12 +22,23 @@ class BlocklistApp(amo.models.ModelBase):
return ['/blocklist*'] # no lang/app
class BlocklistDetail(amo.models.ModelBase):
name = models.CharField(max_length=255)
why = models.TextField()
who = models.TextField()
bug = models.URLField()
class Meta(amo.models.ModelBase.Meta):
db_table = 'bldetails'
class BlocklistItem(amo.models.ModelBase):
guid = models.CharField(max_length=255, blank=True, null=True)
min = models.CharField(max_length=255, blank=True, null=True)
max = models.CharField(max_length=255, blank=True, null=True)
os = models.CharField(max_length=255, blank=True, null=True)
severity = models.SmallIntegerField(null=True)
details = models.OneToOneField(BlocklistDetail, null=True)
class Meta(amo.models.ModelBase.Meta):
db_table = 'blitems'
@ -49,6 +60,7 @@ class BlocklistPlugin(amo.models.ModelBase):
description = models.CharField(max_length=255, blank=True, null=True)
filename = models.CharField(max_length=255, blank=True, null=True)
severity = models.SmallIntegerField(null=True)
details = models.OneToOneField(BlocklistDetail, null=True)
class Meta(amo.models.ModelBase.Meta):
db_table = 'blplugins'
@ -71,6 +83,7 @@ class BlocklistGfx(amo.models.ModelBase):
driver_version = models.CharField(max_length=255, blank=True, null=True)
driver_version_comparator = models.CharField(max_length=255, blank=True,
null=True)
details = models.OneToOneField(BlocklistDetail, null=True)
class Meta:
db_table = 'blgfxdrivers'

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

@ -0,0 +1,26 @@
DROP TABLE IF EXISTS `bldetails`;
CREATE TABLE `bldetails` (
`id` integer AUTO_INCREMENT NOT NULL PRIMARY KEY,
`created` datetime NOT NULL,
`modified` datetime NOT NULL,
`name` varchar(255) NOT NULL,
`why` longtext NOT NULL,
`who` longtext NOT NULL,
`bug` varchar(200) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
ALTER TABLE blitems
ADD COLUMN `details_id` integer UNIQUE,
ADD CONSTRAINT FOREIGN KEY (`details_id`) REFERENCES `bldetails` (`id`);
ALTER TABLE blplugins
ADD COLUMN `details_id` integer UNIQUE,
ADD CONSTRAINT FOREIGN KEY (`details_id`) REFERENCES `bldetails` (`id`);
ALTER TABLE blgfxdrivers
ADD COLUMN `details_id` integer UNIQUE,
ADD CONSTRAINT FOREIGN KEY (`details_id`) REFERENCES `bldetails` (`id`);
UPDATE blitems SET created=NOW() WHERE created IS NULL;
UPDATE blplugins SET created=NOW() WHERE created IS NULL;
UPDATE blgfxdrivers SET created=NOW() WHERE created IS NULL;