User Tools

Site Tools


podoc:album_content_sql_table

Database Table Description of "album_content"

Name

album_content

Description

This table keeps track of what photos are in which albums.

Purpose

Unlike folders, it's possible for a photo to be in more than one album. This table allows for that.

Schema

CREATE TABLE album_content (
  identifier            INTEGER NOT NULL PRIMARY KEY,
  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
);

References tables

  • album references album(identifier)
  • photo references photo(identifier)
  • version references photo_version(identifier)

Is referenced by tables

None.

None.

History

Used first

Version 2.5

Used last

Still in use

Schema change history

= Version 2.5 =

CREATE TABLE album_content (
  identifier            INTEGER NOT NULL PRIMARY KEY,
  photo                 INTEGER NOT NULL REFERENCES photo(identifier),
  album                 INTEGER NOT NULL REFERENCES album(identifier)
);

= Version 2.34 =

-- Add 'version' to album_content to allow individual versions.
ALTER TABLE album_content
  ADD version INTEGER REFERENCES photo_version(identifier);
ALTER TABLE album_content ALTER version SET NOT NULL;
alter table album_content add date_added timestamp without time zone;

== Data change history =

= Version 2.34 =

UPDATE album_content SET version =
   (SELECT identifier FROM photo_version v
    WHERE album_content.photo = v.photo AND v.master = 't');
podoc/album_content_sql_table.txt · Last modified: 2007/10/19 16:55 by Luud