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(identifier)
  • folder references folder(identifier)
  • location references location(identifier)
  • users references users(identifier)

Is referenced by tables

Related tables

Related sequences

Related indexes

Related functions

Related views

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';
podoc/photo_sql_table.txt · Last modified: 2007/10/31 11:43 by Luud
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0