* refactored the system so that it keeps pictures in a seperate table
[selectricity-live] / db / create.sql
index a5a2e0a0fb54b1458ae5e1abb8a8394fb0b454d1..298b99a63276515661ad7839f782d3a995699539 100644 (file)
@@ -27,9 +27,20 @@ create table candidates (
  election_id int NOT NULL,
  name varchar(100) NOT NULL, 
  description text NULL,
- picture_filename varchar(200),
- picture_data blob, 
- picture_type varchar(100), 
+ primary key (id)
+);
+
+# CREATE pictures TABLE
+#####################################
+
+drop table if exists pictures;
+create table pictures (
+ id int NOT NULL auto_increment,
+ filename varchar(200),
+ data blob, 
+ filetype varchar(100), 
+ candidate_id int NULL,
+ constraint fk_candidate_picture foreign key (candidate_id) references candidates(id),
  primary key (id)
 );
 

Benjamin Mako Hill || Want to submit a patch?