[opw-web] Add extra indices on opw_attachments



commit 55faf3720994cf5efd48ec00d2feb06e118909b1
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Mon Apr 21 10:49:59 2014 -0400

    Add extra indices on opw_attachments

 schema.sql |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/schema.sql b/schema.sql
index df29ffd..d3ec138 100644
--- a/schema.sql
+++ b/schema.sql
@@ -124,6 +124,8 @@ alter table opw_attachments add `is_contract` tinyint(1) NOT NULL DEFAULT 0;
 alter table opw_attachments add `program_id` mediumint(6) unsigned NOT NULL;
 alter table opw_attachments add `uploader` varchar(255) NOT NULL;
 create index uploader on opw_attachments (uploader) ;
+alter table opw_attachments add foreign key (`project_id`) references opw_projects (`id`) ;
+alter table opw_attachments add foreign key (`program_id`) references opw_programs (`id`) ;
 update opw_attachments set uploader = (select username from opw_participants p where p.project_id = 
opw_attachments.project_id and p.role = 's');
 update opw_attachments set program_id = (select p.program_id from opw_projects p where p.id = 
opw_attachments.project_id);
 */
@@ -140,5 +142,7 @@ CREATE TABLE `opw_attachments` (
   `data` MEDIUMBLOB NOT NULL,
   `is_contract` tinyint(1) NOT NULL DEFAULT 0,
   PRIMARY KEY (`id`),
+  FOREIGN KEY (`project_id`) REFERENCES `opw_projects`(`id`),
+  FOREIGN KEY (`program_id`) REFERENCES `opw_programs`(`id`),
   KEY (`uploader`)
 ) ENGINE=MyISAM DEFAULT CHARSET=utf8;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]