User Tools

Site Tools


podoc:photo_dupe_sql_table

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
podoc:photo_dupe_sql_table [2007/04/20 15:18] Luudpodoc:photo_dupe_sql_table [2007/10/19 20:53] Luud
Line 19: Line 19:
   storage_location      varchar(50),   storage_location      varchar(50),
   storage_index         varchar(10),   storage_index         varchar(10),
-  remark                text              -- dupe remark+  remark                text,             -- dupe remark 
 +  version               integer not null references photo_version(identifier)
 ); );
 </code> </code>
Line 26: Line 27:
  
   * photo references [[photo sql table|photo]](identifier)   * photo references [[photo sql table|photo]](identifier)
 +  * version references [[photo_version sql table|photo_version]](identifier)
  
 === Is referenced by other tables === === Is referenced by other tables ===
Line 37: Line 39:
 === Related indexes === === Related indexes ===
  
-None.+  * [[photo_dupe_version_idx sql index|photo_dupe_version_idx]]
  
 === Related functions === === Related functions ===
Line 46: Line 48:
  
   * [[view_photo sql view|view_photo]]   * [[view_photo sql view|view_photo]]
-  * [[view_submission sql view|view_submission]]+  * <del>[[view_submission sql view|view_submission]]</del> removed in 2.34
  
 === History === === History ===
Line 58: Line 60:
 Still in use Still in use
  
-== Change history ==+== Schema change history ==
  
 = Version 2.5 = = Version 2.5 =
  
 <code sql> <code sql>
-  create table photo_dupe ( +create table photo_dupe ( 
-    identifier            integer not null primary key, +  identifier            integer not null primary key, 
-    key                   integer not null, +  key                   integer not null, 
-    photo                 integer not null references photo(identifier), +  photo                 integer not null references photo(identifier), 
-    date_of_creation      timestamp,        -- date when it was inserted in the system +  date_of_creation      timestamp,        -- date when it was inserted in the system 
-    storage_location      varchar(50), +  storage_location      varchar(50), 
-    storage_index         varchar(10), +  storage_index         varchar(10), 
-    remark                text              -- dupe remark +  remark                text              -- dupe remark 
-  );+); 
 +</code> 
 + 
 += Version 2.34 = 
 + 
 +<code sql> 
 +-- Add 'version' to photo_dupe to allow individual versions. 
 + 
 + 
 +ALTER TABLE photo_dupe 
 +  ADD version integer REFERENCES photo_version(identifier); 
 + 
 + 
 +ALTER TABLE photo_dupe ALTER version SET NOT NULL; 
 +</code> 
 + 
 +== Data change history = 
 + 
 += Version 2.34 = 
 + 
 +<code sql> 
 +UPDATE photo_dupe set version = 
 +   (SELECT identifier from photo_version v 
 +    WHERE photo_dupe.photo = v.photo AND v.master = 't');
 </code> </code>
  
podoc/photo_dupe_sql_table.txt · Last modified: 2007/10/31 15:38 by Luud