===== Database Table Description of "photo" =====
=== Name ===
photo
=== Description ===
=== Purpose ===
=== Schema ===
create table photo (
identifier integer not null primary key,
users integer not null references users(identifier), -- the users who uploaded the picture, not necessarily the owner
folder integer not null references folder(identifier),
location integer not null references location(identifier),
caption text, -- a novel describing how the picture was made, or what can we see on it
date_of_exposure timestamp, -- date when the picture was taken
access_rights integer not null references access_type(identifier),
views integer,
copyright_statement text,
hide_original char(1) check (hide_original in ('t', 'f')),
author text,
title text,
caption_writer text,
category varchar(3),
credit text,
source text,
headline text,
instructions text,
transmission_reference text,
supplemental_category text,
web_statement text,
date_added timestamp without time zone,
date_changed timestamp without time zone,
store_url text,
comments text
);
=== References tables ===
* access_rights references [[access_type sql table|access_type]](identifier)
* folder references [[folder sql table|folder]](identifier)
* location references [[location sql table|location]](identifier)
* users references [[users sql table|users]](identifier)
=== Is referenced by tables ===
* [[album_content sql table|album_content]](photo) references identifier
* [[photo_dupe sql table|photo_dupe]](photo) references identifier
* [[photo_item sql table|photo_item]](photo) references identifier removed in 2.34
* [[photo_keywords sql table|photo_keywords]](photo) references identifier
* [[photo_spooler sql table|photo_spooler]](photo) references identifier removed in 2.34
* [[photo_tech sql table|photo_tech]](photo) references identifier
* [[photo_version sql table|photo_version]](photo) references identifier
* [[rating sql table|rating]](photo) references identifier
=== Related tables ===
* [[photo_version sql table|photo_version]]
=== Related sequences ===
* [[photo_id_sequence sql sequence|photo_id_sequence]]
=== Related indexes ===
* [[photo_folder sql index|photo_folder]]
* [[photo_id_idx sql index|photo_id_idx]] removed in 2.34
* [[photo_users_idx sql index|photo_users_idx]]
* [[photo_location_idx sql index|photo_location_idx]]
=== Related functions ===
* [[count_photo_versions_by_user sql function|count_photo_versions_by_user]]
* [[count_photos sql function|count_photos]]
* [[count_photos_by_album sql function|count_photos_by_album]]
* [[count_photos_by_folder sql function|count_photos_by_folder]]
* [[count_photos_by_user sql function|count_photos_by_user]]
* [[is_photo_for_sale sql function|is_photo_for_sale]]
* [[number_of_location_references sql function|number_of_location_references]]
=== Related views ===
* [[view_photo sql view|view_photo]]
* [[view_random_photo sql view|view_random_photo]]
=== History ===
== Used first ==
Version 2.5
== Used last ==
Still in use
== Schema change history ==
= Version 2.5 =
create table photo (
identifier integer not null primary key,
users integer not null references users(identifier), -- the users who uploaded the picture, not necessarily the owner
folder integer not null references folder(identifier),
location integer references location(identifier),
caption text, -- a novel describing how the picture was made, or what can we see on it
date_of_exposure timestamp, -- date when the picture was taken
small_image_path varchar(500), -- path to the thumbnail
medium_image_path varchar(500), -- path to the medium image
large_image_path varchar(500), -- path to the highres image
access_rights integer not null references access_type(identifier)
);
= Version 2.6 =
alter table photo add column views integer;
alter table photo add column copyright_statement text;
= Version 2.7 =
-- we rename colums first since droping was implemented only with 7.3
alter table photo rename column small_image_path to drop_me_small_image_path;
alter table photo rename column medium_image_path to drop_me_medium_image_path;
alter table photo rename column large_image_path to drop_me_large_image_path;
-- drop columns which aren't used any longer
alter table photo drop column drop_me_small_image_path;
alter table photo drop column drop_me_medium_image_path;
alter table photo drop column drop_me_large_image_path;
= Version 2.11 =
-- add support for original protection
alter table photo add column hide_original char(1) check (hide_original in ('t', 'f'));
= Version 2.15 =
alter table photo add column author text;
alter table photo add column keyword text;
alter table photo add column title text;
= Version 2.17 =
alter table photo add column caption_writer text;
alter table photo add column category varchar(3);
alter table photo add column credit text;
alter table photo add column source text;
alter table photo add column headline text;
alter table photo add column instructions text;
alter table photo add column transmission_reference text;
alter table photo add column supplemental_category text;
alter table photo add column web_statement text;
= Version 2.31 =
update photo set location = 0 where location is null;
alter table photo alter location set not null;
= Version 2.33 =
-- This is called by the upgrade script --
-- alter table photo drop keyword;
= Version 2.34 =
-- Add a field to track when a photo was added
alter table photo add date_added timestamp without time zone;
alter table photo add date_changed timestamp without time zone;
--- Add a 'purcahse url' to photos.
alter table photo add store_url text;
-- Add a comments column to the photos.
alter table photo add column comments text;
== Data change history ==
= Version 2.6 =
-- set the photo view flag to null for each photo
update photo set views=0;
= Version 2.11 =
update photo set hide_original='f';
= Version 2.15 =
update photo set caption ='' where caption='No Caption';