User Tools

Site Tools


podoc:album_content_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
podoc:album_content_sql_table [2007/04/18 12:41] – description. pizzapodoc:album_content_sql_table [2007/10/19 20:55] (current) Luud
Line 15: Line 15:
 === Schema === === Schema ===
  
-  create table album_content ( +<code sql> 
-    identifier            integer not null primary key, +create table album_content ( 
-    photo                 integer not null references photo(identifier), +  identifier            integer not null primary key, 
-    album                 integer not null references album(identifier) +  photo                 integer not null references photo(identifier), 
-  );+  album                 integer not null references album(identifier), 
 +  version               integer not null references photo_version(identifier), 
 +  date_changed          timestamp without time zone 
 +); 
 +</code> 
 + 
 +=== References tables === 
 + 
 +  * album references [[album sql table|album]](identifier) 
 +  * photo references [[photo sql table|photo]](identifier) 
 +  * version references [[photo_version sql table|photo_version]](identifier) 
 + 
 +=== Is referenced by tables === 
 + 
 +None. 
  
 === Related sequences === === Related sequences ===
Line 28: Line 42:
  
   * [[album_content_album_idx sql index|album_content_album_idx]]   * [[album_content_album_idx sql index|album_content_album_idx]]
-  * [[album_content_id_idx sql index|album_content_id_idx]]+  * <del>[[album_content_id_idx sql index|album_content_id_idx]]</del> removed in 2.34
   * [[album_content_photo_idx sql index|album_content_photo_idx]]   * [[album_content_photo_idx sql index|album_content_photo_idx]]
 +  * [[album_content_version_idx sql index|album_content_version_idx]]
  
 === Related functions === === Related functions ===
 +
 +  * [[count_photos_by_album sql function|count_photos_by_album]]
 +  * [[count_photos_by_user sql function|count_photos_by_user]]
  
 === Related views === === Related views ===
 +
 +None.
  
 === History === === History ===
Line 45: Line 65:
 Still in use Still in use
  
-== Change history ==+== Schema change history ==
  
 = Version 2.5 = = Version 2.5 =
  
-  create table album_content ( +<code sql> 
-    identifier            integer not null primary key, +create table album_content ( 
-    photo                 integer not null references photo(identifier), +  identifier            integer not null primary key, 
-    album                 integer not null references album(identifier) +  photo                 integer not null references photo(identifier), 
-  );+  album                 integer not null references album(identifier) 
 +); 
 +</code> 
 + 
 += Version 2.34 = 
 + 
 +<code sql> 
 +-- Add 'version' to album_content to allow individual versions. 
 +ALTER TABLE album_content 
 +  ADD version integer REFERENCES photo_version(identifier); 
 +</code> 
 + 
 +<code sql> 
 +ALTER TABLE album_content ALTER version SET NOT NULL; 
 +</code> 
 + 
 +<code> 
 +alter table album_content add date_added timestamp without time zone; 
 +</code> 
 + 
 +== Data change history = 
 + 
 += Version 2.34 = 
 + 
 +<code sql> 
 +UPDATE album_content set version = 
 +   (SELECT identifier from photo_version v 
 +    WHERE album_content.photo = v.photo AND v.master = 't'); 
 +</code>
  
podoc/album_content_sql_table.1176900062.txt.gz · Last modified: 2007/04/18 12:41 by pizza