===== 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 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 ===
* [[album_content_id_sequence sql sequence|album_content_id_sequence]]
=== Related indexes ===
* [[album_content_album_idx sql index|album_content_album_idx]]
* [[album_content_id_idx sql index|album_content_id_idx]] removed in 2.34
* [[album_content_photo_idx sql index|album_content_photo_idx]]
* [[album_content_version_idx sql index|album_content_version_idx]]
=== Related functions ===
* [[count_photos_by_album sql function|count_photos_by_album]]
* [[count_photos_by_user sql function|count_photos_by_user]]
=== Related views ===
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');