Skip to content
This repository has been archived by the owner on Mar 15, 2018. It is now read-only.

Commit

Permalink
adding a table for blocklist details
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Balogh committed Mar 31, 2011
1 parent 36bf983 commit 2439176
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
13 changes: 13 additions & 0 deletions apps/blocklist/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,23 @@ def flush_urls(self):
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'
Expand All @@ -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'
Expand All @@ -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'
Expand Down
26 changes: 26 additions & 0 deletions migrations/172-blocklist-deets.sql
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit 2439176

Please sign in to comment.