User Tools

Site Tools


podoc:schema-2.33c

Database schema dump of PO 2.33c

--
-- PostgreSQL database dump
--
 
SET client_encoding = 'UTF8';
SET check_function_bodies = FALSE;
SET client_min_messages = warning;
 
--
-- Name: SCHEMA public; Type: COMMENT; Schema: -; Owner: postgres
--
 
COMMENT ON SCHEMA public IS 'Standard public schema';
 
 
--
-- Name: plpgsql; Type: PROCEDURAL LANGUAGE; Schema: -; Owner: 
--
 
CREATE PROCEDURAL LANGUAGE plpgsql;
 
 
SET search_path = public, pg_catalog;
 
--
-- Name: concat_ignore_null(character varying, character varying); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION concat_ignore_null(CHARACTER VARYING, CHARACTER VARYING) RETURNS CHARACTER VARYING
    AS $_$ DECLARE string_1         alias FOR $1; string_2         alias FOR $2; BEGIN IF string_1 IS NULL THEN RETURN string_2; END IF;  IF string_2 IS NULL THEN RETURN string_1; END IF;  RETURN string_1||string_2; END; $_$
    LANGUAGE plpgsql;
 
 
ALTER FUNCTION public.concat_ignore_null(CHARACTER VARYING, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: count_albums_by_user(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_albums_by_user(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM album WHERE users = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_albums_by_user(INTEGER) OWNER TO po_user;
 
--
-- Name: count_albums_by_user(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_albums_by_user(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM album WHERE users = $1 AND access_rights <= $2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_albums_by_user(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_equipment_by_user(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_equipment_by_user(INTEGER) RETURNS BIGINT
    AS $_$select ((SELECT COUNT(identifier) FROM lens WHERE users = $1) + (SELECT COUNT(identifier) FROM camera WHERE users = $1) + (SELECT COUNT(identifier) FROM flash WHERE users = $1) + (SELECT COUNT(identifier) FROM scanner WHERE users = $1) + (SELECT COUNT(identifier) FROM film WHERE users = $1) + (SELECT COUNT(identifier) FROM support WHERE users = $1) + (SELECT COUNT(identifier) FROM flash WHERE users = $1))$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_equipment_by_user(INTEGER) OWNER TO po_user;
 
--
-- Name: count_equipment_by_user(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_equipment_by_user(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select ((SELECT COUNT(identifier) FROM lens WHERE users = $1 AND access_rights <= $2) + (SELECT COUNT(identifier) FROM camera WHERE users = $1 AND access_rights <= $2) + (SELECT COUNT(identifier) FROM flash WHERE users = $1 AND access_rights <= $2) + (SELECT COUNT(identifier) FROM scanner WHERE users = $1 AND access_rights <= $2) + (SELECT COUNT(identifier) FROM film WHERE users = $1 AND access_rights <= $2) + (SELECT COUNT(identifier) FROM support WHERE users = $1 AND access_rights <= $2) + (SELECT COUNT(identifier) FROM flash WHERE users = $1 AND access_rights <= $2))$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_equipment_by_user(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_folders_by_user(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_folders_by_user(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM folder WHERE users = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_folders_by_user(INTEGER) OWNER TO po_user;
 
--
-- Name: count_folders_by_user(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_folders_by_user(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM folder WHERE users = $1 AND access_rights <= $2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_folders_by_user(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_photo_versions(); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photo_versions() RETURNS BIGINT
    AS $$select COUNT(identifier) FROM photo_version$$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photo_versions() OWNER TO po_user;
 
--
-- Name: count_photo_versions_by_user(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photo_versions_by_user(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_version.identifier) FROM photo_version, photo WHERE photo_version.photo=photo.identifier AND photo.users = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photo_versions_by_user(INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos(); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos() RETURNS BIGINT
    AS $$select COUNT(identifier) FROM photo$$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos() OWNER TO po_user;
 
--
-- Name: count_photos(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM photo WHERE access_rights <= $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos(INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos_by_album(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos_by_album(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo.identifier) FROM album_content, photo WHERE album_content.photo=photo.identifier AND album = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos_by_album(INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos_by_album(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos_by_album(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo.identifier) FROM album_content, photo, album WHERE album_content.photo=photo.identifier AND album_content.album=album.identifier AND album_content.album = $1 AND photo.access_rights <= $2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos_by_album(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos_by_folder(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos_by_folder(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM photo WHERE folder = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos_by_folder(INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos_by_folder(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos_by_folder(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM photo WHERE folder = $1 AND access_rights <= $2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos_by_folder(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos_by_user(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos_by_user(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM photo WHERE users = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos_by_user(INTEGER) OWNER TO po_user;
 
--
-- Name: count_photos_by_user(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_photos_by_user(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo.identifier) FROM photo, folder WHERE photo.folder=folder.identifier AND photo.users = $1 AND photo.access_rights <= $2 AND (folder.access_rights <= $2 OR (SELECT album.access_rights FROM album, album_content WHERE album_content.album=album.identifier AND album_content.photo=photo.identifier AND album.access_rights <= $2 LIMIT 1) <= $2) $_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_photos_by_user(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_subalbums_by_album(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_subalbums_by_album(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM album WHERE parent_album = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_subalbums_by_album(INTEGER) OWNER TO po_user;
 
--
-- Name: count_subalbums_by_album(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_subalbums_by_album(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM album WHERE parent_album = $1 AND access_rights <= $2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_subalbums_by_album(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_subfolders_by_folder(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_subfolders_by_folder(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM folder WHERE parent_folder = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_subfolders_by_folder(INTEGER) OWNER TO po_user;
 
--
-- Name: count_subfolders_by_folder(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_subfolders_by_folder(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM folder WHERE parent_folder = $1 AND access_rights <= $2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_subfolders_by_folder(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: count_users(); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION count_users() RETURNS BIGINT
    AS $$select COUNT(identifier) FROM users$$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.count_users() OWNER TO po_user;
 
--
-- Name: is_photo_for_sale(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION is_photo_for_sale(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_item.identifier) FROM photo, photo_item WHERE photo.identifier=photo_item.photo AND photo.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.is_photo_for_sale(INTEGER) OWNER TO po_user;
 
--
-- Name: is_user_my_client(integer, integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION is_user_my_client(INTEGER, INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM client WHERE client.users = $1 AND client.client = $2 AND STATUS=2$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.is_user_my_client(INTEGER, INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_camera_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_camera_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, camera WHERE photo_tech.camera=camera.identifier AND camera.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_camera_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_dupes(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_dupes(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(identifier) FROM photo_dupe WHERE photo = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_dupes(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_film_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_film_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, film WHERE photo_tech.film=film.identifier AND film.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_film_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_filter_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_filter_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, FILTER WHERE photo_tech.FILTER=FILTER.identifier AND FILTER.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_filter_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_flash_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_flash_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, flash WHERE photo_tech.flash=flash.identifier AND flash.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_flash_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_lens_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_lens_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, lens WHERE photo_tech.lens=lens.identifier AND lens.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_lens_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_location_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_location_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo.identifier) FROM photo, location WHERE photo.location=location.identifier AND location.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_location_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_manufacturer_ref(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_manufacturer_ref(INTEGER) RETURNS BIGINT
    AS $_$select ((SELECT COUNT(identifier) FROM lens_type WHERE manufacturer = $1) + (SELECT COUNT(identifier) FROM camera_type WHERE manufacturer = $1) + (SELECT COUNT(identifier) FROM flash_type WHERE manufacturer = $1) + (SELECT COUNT(identifier) FROM scanner_type WHERE manufacturer = $1) + (SELECT COUNT(identifier) FROM support_type WHERE manufacturer = $1) + (SELECT COUNT(identifier) FROM film_type WHERE manufacturer = $1) + (SELECT COUNT(identifier) FROM flash_type WHERE manufacturer = $1))$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_manufacturer_ref(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_scanner_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_scanner_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, scanner WHERE photo_tech.scanner=scanner.identifier AND scanner.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_scanner_references(INTEGER) OWNER TO po_user;
 
--
-- Name: number_of_support_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION number_of_support_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(photo_tech.identifier) FROM photo_tech, support WHERE photo_tech.support=support.identifier AND support.identifier = $1$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.number_of_support_references(INTEGER) OWNER TO po_user;
 
--
-- Name: photo_shop_transaction_references(integer); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION photo_shop_transaction_references(INTEGER) RETURNS BIGINT
    AS $_$select COUNT(shop_order.TRANSACTION) FROM photo_item, shop_order WHERE photo_item.photo = $1 AND photo_item.identifier=shop_order.item$_$
    LANGUAGE SQL;
 
 
ALTER FUNCTION public.photo_shop_transaction_references(INTEGER) OWNER TO po_user;
 
--
-- Name: tokenized_ilike(character varying, character varying); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION tokenized_ilike(CHARACTER VARYING, CHARACTER VARYING) RETURNS BOOLEAN
    AS $_$ DECLARE string alias FOR $1; keyword alias FOR $2; BEGIN RETURN tokenized_like(LOWER(string), LOWER(keyword)); END; $_$
    LANGUAGE plpgsql;
 
 
ALTER FUNCTION public.tokenized_ilike(CHARACTER VARYING, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: tokenized_ilike(integer, character varying); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION tokenized_ilike(INTEGER, CHARACTER VARYING) RETURNS BOOLEAN
    AS $_$ DECLARE identifier alias FOR $1; keyword alias FOR $2; BEGIN RETURN tokenized_ilike(text(identifier), keyword); END; $_$
    LANGUAGE plpgsql;
 
 
ALTER FUNCTION public.tokenized_ilike(INTEGER, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: tokenized_like(character varying, character varying); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION tokenized_like(CHARACTER VARYING, CHARACTER VARYING) RETURNS BOOLEAN
    AS $_$ DECLARE string alias FOR $1; keyword alias FOR $2;  token VARCHAR; CHARACTER CHAR; string_length INTEGER; token_length INTEGER; token_begin INTEGER; index_cursor INTEGER; head_cursor INTEGER; BEGIN head_cursor := 1; string_length := CHAR_LENGTH(string);  while head_cursor < string_length loop token_length := 0; index_cursor := head_cursor; token_begin := head_cursor; CHARACTER := SUBSTRING(string FROM index_cursor FOR 1); while index_cursor <= string_length loop IF ((CHARACTER = ' ') OR (CHARACTER = ';') OR (index_cursor = string_length)) THEN IF (index_cursor = string_length) THEN token_length := token_length + 1; END IF; token := SUBSTRING(string FROM token_begin FOR token_length); IF (token = keyword) THEN RETURN TRUE; END IF; END IF; token_length := token_length + 1; index_cursor := index_cursor + 1; CHARACTER := SUBSTRING(string FROM index_cursor FOR 1); END loop;  index_cursor := head_cursor; while index_cursor <= string_length loop CHARACTER := SUBSTRING(string FROM index_cursor FOR 1); IF ((CHARACTER = ' ') OR (CHARACTER = ';') OR (index_cursor = string_length)) THEN head_cursor := index_cursor + 1; exit; END IF; index_cursor := index_cursor + 1; END loop; END loop;  RETURN FALSE; END; $_$
    LANGUAGE plpgsql;
 
 
ALTER FUNCTION public.tokenized_like(CHARACTER VARYING, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: tokenized_like(integer, character varying); Type: FUNCTION; Schema: public; Owner: po_user
--
 
CREATE FUNCTION tokenized_like(INTEGER, CHARACTER VARYING) RETURNS BOOLEAN
    AS $_$ DECLARE identifier alias FOR $1; keyword alias FOR $2; BEGIN RETURN tokenized_like(text(identifier), keyword); END; $_$
    LANGUAGE plpgsql;
 
 
ALTER FUNCTION public.tokenized_like(INTEGER, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: =##=; Type: OPERATOR; Schema: public; Owner: po_user
--
 
CREATE OPERATOR =##= (
    PROCEDURE = tokenized_ilike,
    LEFTARG = CHARACTER VARYING,
    RIGHTARG = CHARACTER VARYING,
    COMMUTATOR = =##=
);
 
 
ALTER OPERATOR public.=##= (CHARACTER VARYING, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: =##=; Type: OPERATOR; Schema: public; Owner: po_user
--
 
CREATE OPERATOR =##= (
    PROCEDURE = tokenized_ilike,
    LEFTARG = INTEGER,
    RIGHTARG = CHARACTER VARYING,
    COMMUTATOR = =##=
);
 
 
ALTER OPERATOR public.=##= (INTEGER, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: ====; Type: OPERATOR; Schema: public; Owner: po_user
--
 
CREATE OPERATOR ==== (
    PROCEDURE = tokenized_like,
    LEFTARG = CHARACTER VARYING,
    RIGHTARG = CHARACTER VARYING,
    COMMUTATOR = ====
);
 
 
ALTER OPERATOR public.==== (CHARACTER VARYING, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: ====; Type: OPERATOR; Schema: public; Owner: po_user
--
 
CREATE OPERATOR ==== (
    PROCEDURE = tokenized_like,
    LEFTARG = INTEGER,
    RIGHTARG = CHARACTER VARYING,
    COMMUTATOR = ====
);
 
 
ALTER OPERATOR public.==== (INTEGER, CHARACTER VARYING) OWNER TO po_user;
 
--
-- Name: |||; Type: OPERATOR; Schema: public; Owner: po_user
--
 
CREATE OPERATOR ||| (
    PROCEDURE = concat_ignore_null,
    LEFTARG = CHARACTER VARYING,
    RIGHTARG = CHARACTER VARYING
);
 
 
ALTER OPERATOR public.||| (CHARACTER VARYING, CHARACTER VARYING) OWNER TO po_user;
 
SET default_tablespace = '';
 
SET default_with_oids = FALSE;
 
--
-- Name: access_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE access_type (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(10)
);
 
 
ALTER TABLE public.access_type OWNER TO po_user;
 
--
-- Name: access_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE access_type_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.access_type_id_sequence OWNER TO po_user;
 
--
-- Name: album; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE album (
    identifier INTEGER NOT NULL,
    users INTEGER NOT NULL,
    caption text,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    access_rights INTEGER NOT NULL,
    "type" CHARACTER(1),
    orderby INTEGER,
    description text,
    parent_album INTEGER,
    CONSTRAINT album_type_check CHECK ((("type" = 'c'::bpchar) OR ("type" = 'u'::bpchar)))
);
 
 
ALTER TABLE public.album OWNER TO po_user;
 
--
-- Name: album_content; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE album_content (
    identifier INTEGER NOT NULL,
    photo INTEGER NOT NULL,
    album INTEGER NOT NULL
);
 
 
ALTER TABLE public.album_content OWNER TO po_user;
 
--
-- Name: album_content_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE album_content_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.album_content_id_sequence OWNER TO po_user;
 
--
-- Name: album_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE album_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.album_id_sequence OWNER TO po_user;
 
--
-- Name: aperture; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE aperture (
    identifier INTEGER NOT NULL,
    VALUE NUMERIC
);
 
 
ALTER TABLE public.aperture OWNER TO po_user;
 
--
-- Name: aperture_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE aperture_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.aperture_id_sequence OWNER TO po_user;
 
--
-- Name: calendar; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE calendar (
    identifier INTEGER NOT NULL,
    users INTEGER NOT NULL,
    start_date TIMESTAMP WITHOUT TIME zone,
    end_date TIMESTAMP WITHOUT TIME zone,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    remark text
);
 
 
ALTER TABLE public.calendar OWNER TO po_user;
 
--
-- Name: calendar_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE calendar_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.calendar_id_sequence OWNER TO po_user;
 
--
-- Name: camera; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE camera (
    identifier INTEGER NOT NULL,
    "type" INTEGER,
    users INTEGER,
    serial_number CHARACTER VARYING(20),
    date_of_purchase TIMESTAMP WITHOUT TIME zone,
    purchased_new CHARACTER(1),
    access_rights INTEGER NOT NULL,
    CONSTRAINT camera_purchased_new_check CHECK (((purchased_new = 't'::bpchar) OR (purchased_new = 'f'::bpchar)))
);
 
 
ALTER TABLE public.camera OWNER TO po_user;
 
--
-- Name: camera_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE camera_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.camera_id_sequence OWNER TO po_user;
 
--
-- Name: camera_metering; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE camera_metering (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(40)
);
 
 
ALTER TABLE public.camera_metering OWNER TO po_user;
 
--
-- Name: camera_metering_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE camera_metering_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.camera_metering_id_sequence OWNER TO po_user;
 
--
-- Name: camera_program; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE camera_program (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(40)
);
 
 
ALTER TABLE public.camera_program OWNER TO po_user;
 
--
-- Name: camera_program_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE camera_program_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.camera_program_id_sequence OWNER TO po_user;
 
--
-- Name: camera_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE camera_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    variation CHARACTER VARYING(100),
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER,
    raw_icc_profile INTEGER
);
 
 
ALTER TABLE public.camera_type OWNER TO po_user;
 
--
-- Name: camera_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE camera_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.camera_type_id_sequence OWNER TO po_user;
 
--
-- Name: client; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE client (
    identifier INTEGER NOT NULL,
    users INTEGER NOT NULL,
    client INTEGER NOT NULL,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    STATUS INTEGER NOT NULL,
    "trusted" CHARACTER(1),
    CONSTRAINT client_trusted_check CHECK ((("trusted" = 't'::bpchar) OR ("trusted" = 'f'::bpchar)))
);
 
 
ALTER TABLE public.client OWNER TO po_user;
 
--
-- Name: client_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE client_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.client_id_sequence OWNER TO po_user;
 
--
-- Name: client_status; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE client_status (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(12)
);
 
 
ALTER TABLE public.client_status OWNER TO po_user;
 
--
-- Name: client_status_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE client_status_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.client_status_id_sequence OWNER TO po_user;
 
--
-- Name: contact_info; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE contact_info (
    identifier INTEGER NOT NULL,
    address1 CHARACTER VARYING(100),
    address2 CHARACTER VARYING(100),
    city CHARACTER VARYING(100),
    zipcode CHARACTER VARYING(10),
    state INTEGER,
    country INTEGER,
    phone CHARACTER VARYING(40),
    email CHARACTER VARYING(150),
    url CHARACTER VARYING(150)
);
 
 
ALTER TABLE public.contact_info OWNER TO po_user;
 
--
-- Name: contact_info_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE contact_info_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.contact_info_id_sequence OWNER TO po_user;
 
--
-- Name: country; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE country (
    identifier INTEGER NOT NULL,
    code CHARACTER VARYING(5),
    VALUE CHARACTER VARYING(40)
);
 
 
ALTER TABLE public.country OWNER TO po_user;
 
--
-- Name: country_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE country_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.country_id_sequence OWNER TO po_user;
 
--
-- Name: currency; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE currency (
    identifier INTEGER NOT NULL,
    numeric_code NUMERIC,
    alpha_code CHARACTER VARYING(5),
    name CHARACTER VARYING(40),
    entity text
);
 
 
ALTER TABLE public.currency OWNER TO po_user;
 
--
-- Name: currency_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE currency_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.currency_id_sequence OWNER TO po_user;
 
--
-- Name: dcraw_options; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE dcraw_options (
    identifier INTEGER NOT NULL,
    gamma DOUBLE PRECISION,
    brightness DOUBLE PRECISION,
    white_balance CHARACTER VARYING(10),
    bitdepth INTEGER,
    CONSTRAINT dcraw_options_bitdepth_check CHECK (((bitdepth = 24) OR (bitdepth = 48))),
    CONSTRAINT dcraw_options_white_balance_check CHECK ((((white_balance)::text = 'camera'::text) OR ((white_balance)::text = 'automatic'::text)))
);
 
 
ALTER TABLE public.dcraw_options OWNER TO po_user;
 
--
-- Name: dcraw_options_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE dcraw_options_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.dcraw_options_id_sequence OWNER TO po_user;
 
--
-- Name: ev_comp; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE ev_comp (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(10)
);
 
 
ALTER TABLE public.ev_comp OWNER TO po_user;
 
--
-- Name: ev_comp_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE ev_comp_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.ev_comp_id_sequence OWNER TO po_user;
 
--
-- Name: film; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE film (
    identifier INTEGER NOT NULL,
    "type" INTEGER NOT NULL,
    users INTEGER NOT NULL,
    access_rights INTEGER NOT NULL
);
 
 
ALTER TABLE public.film OWNER TO po_user;
 
--
-- Name: film_format; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE film_format (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(10)
);
 
 
ALTER TABLE public.film_format OWNER TO po_user;
 
--
-- Name: film_format_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE film_format_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.film_format_id_sequence OWNER TO po_user;
 
--
-- Name: film_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE film_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.film_id_sequence OWNER TO po_user;
 
--
-- Name: film_iso; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE film_iso (
    identifier INTEGER NOT NULL,
    VALUE INTEGER
);
 
 
ALTER TABLE public.film_iso OWNER TO po_user;
 
--
-- Name: film_iso_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE film_iso_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.film_iso_id_sequence OWNER TO po_user;
 
--
-- Name: film_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE film_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    iso INTEGER NOT NULL,
    format INTEGER NOT NULL,
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.film_type OWNER TO po_user;
 
--
-- Name: film_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE film_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.film_type_id_sequence OWNER TO po_user;
 
--
-- Name: filter; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE FILTER (
    identifier INTEGER NOT NULL,
    "type" INTEGER NOT NULL,
    users INTEGER NOT NULL,
    date_of_purchase TIMESTAMP WITHOUT TIME zone,
    purchased_new CHARACTER(1),
    access_rights INTEGER NOT NULL,
    serial_number CHARACTER VARYING(20),
    CONSTRAINT filter_purchased_new_check CHECK (((purchased_new = 't'::bpchar) OR (purchased_new = 'f'::bpchar)))
);
 
 
ALTER TABLE public.FILTER OWNER TO po_user;
 
--
-- Name: filter_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE filter_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.filter_id_sequence OWNER TO po_user;
 
--
-- Name: filter_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE filter_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    variation CHARACTER VARYING(100),
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.filter_type OWNER TO po_user;
 
--
-- Name: filter_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE filter_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.filter_type_id_sequence OWNER TO po_user;
 
--
-- Name: flash; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE flash (
    identifier INTEGER NOT NULL,
    "type" INTEGER NOT NULL,
    users INTEGER NOT NULL,
    serial_number CHARACTER VARYING(20),
    date_of_purchase TIMESTAMP WITHOUT TIME zone,
    purchased_new CHARACTER(1),
    access_rights INTEGER NOT NULL,
    CONSTRAINT flash_purchased_new_check CHECK (((purchased_new = 't'::bpchar) OR (purchased_new = 'f'::bpchar)))
);
 
 
ALTER TABLE public.flash OWNER TO po_user;
 
--
-- Name: flash_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE flash_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.flash_id_sequence OWNER TO po_user;
 
--
-- Name: flash_mode; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE flash_mode (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(40)
);
 
 
ALTER TABLE public.flash_mode OWNER TO po_user;
 
--
-- Name: flash_mode_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE flash_mode_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.flash_mode_id_sequence OWNER TO po_user;
 
--
-- Name: flash_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE flash_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    variation CHARACTER VARYING(100),
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.flash_type OWNER TO po_user;
 
--
-- Name: flash_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE flash_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.flash_type_id_sequence OWNER TO po_user;
 
--
-- Name: focal_length; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE focal_length (
    identifier INTEGER NOT NULL,
    VALUE INTEGER
);
 
 
ALTER TABLE public.focal_length OWNER TO po_user;
 
--
-- Name: focal_length_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE focal_length_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.focal_length_id_sequence OWNER TO po_user;
 
--
-- Name: folder; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE folder (
    identifier INTEGER NOT NULL,
    parent_folder INTEGER,
    users INTEGER NOT NULL,
    caption text,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    access_rights INTEGER NOT NULL,
    orderby INTEGER,
    description text
);
 
 
ALTER TABLE public.folder OWNER TO po_user;
 
--
-- Name: folder_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE folder_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.folder_id_sequence OWNER TO po_user;
 
--
-- Name: imagemagick_composite_options; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE imagemagick_composite_options (
    identifier INTEGER NOT NULL,
    gravity CHARACTER VARYING(20),
    watermark INTEGER NOT NULL,
    photo_version INTEGER,
    CONSTRAINT imagemagick_composite_options_gravity_check CHECK ((((((((((((gravity)::text = 'center'::text) OR ((gravity)::text = 'northwest'::text)) OR ((gravity)::text = 'north'::text)) OR ((gravity)::text = 'northeast'::text)) OR ((gravity)::text = 'west'::text)) OR ((gravity)::text = 'center'::text)) OR ((gravity)::text = 'east'::text)) OR ((gravity)::text = 'southwest'::text)) OR ((gravity)::text = 'south'::text)) OR ((gravity)::text = 'southeast'::text)))
);
 
 
ALTER TABLE public.imagemagick_composite_options OWNER TO po_user;
 
--
-- Name: imagemagick_composite_options_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE imagemagick_composite_options_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.imagemagick_composite_options_id_sequence OWNER TO po_user;
 
--
-- Name: imagemagick_options; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE imagemagick_options (
    identifier INTEGER NOT NULL,
    preview_quality INTEGER,
    preview_colorspace CHARACTER VARYING(20),
    preview_gamma DOUBLE PRECISION,
    preview_sharpen_radius DOUBLE PRECISION,
    preview_sharpen_sigma DOUBLE PRECISION,
    preview_border_width INTEGER,
    preview_border_height INTEGER,
    preview_border_color CHARACTER VARYING(6),
    thumb_quality INTEGER,
    thumb_colorspace CHARACTER VARYING(20),
    thumb_gamma DOUBLE PRECISION,
    thumb_sharpen_radius DOUBLE PRECISION,
    thumb_sharpen_sigma DOUBLE PRECISION,
    thumb_border_width INTEGER,
    thumb_border_height INTEGER,
    thumb_border_color CHARACTER VARYING(6),
    preview_sharpen_threshold DOUBLE PRECISION,
    preview_sharpen_amount DOUBLE PRECISION,
    thumb_sharpen_threshold DOUBLE PRECISION,
    thumb_sharpen_amount DOUBLE PRECISION
);
 
 
ALTER TABLE public.imagemagick_options OWNER TO po_user;
 
--
-- Name: imagemagick_options_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE imagemagick_options_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.imagemagick_options_id_sequence OWNER TO po_user;
 
--
-- Name: label; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE label (
    identifier INTEGER NOT NULL,
    users INTEGER,
    manufacturer INTEGER,
    name CHARACTER VARYING(300),
    space_x DOUBLE PRECISION,
    space_y DOUBLE PRECISION,
    size_x DOUBLE PRECISION,
    size_y DOUBLE PRECISION,
    offset_x DOUBLE PRECISION,
    offset_y DOUBLE PRECISION,
    COLUMNS DOUBLE PRECISION,
    "rows" DOUBLE PRECISION,
    paper INTEGER NOT NULL,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    last_modified_date TIMESTAMP WITHOUT TIME zone
);
 
 
ALTER TABLE public.label OWNER TO po_user;
 
--
-- Name: label_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE label_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.label_id_sequence OWNER TO po_user;
 
--
-- Name: lens; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE lens (
    identifier INTEGER NOT NULL,
    "type" INTEGER NOT NULL,
    users INTEGER NOT NULL,
    serial_number CHARACTER VARYING(20),
    date_of_purchase TIMESTAMP WITHOUT TIME zone,
    purchased_new CHARACTER(1),
    access_rights INTEGER NOT NULL,
    CONSTRAINT lens_purchased_new_check CHECK (((purchased_new = 't'::bpchar) OR (purchased_new = 'f'::bpchar)))
);
 
 
ALTER TABLE public.lens OWNER TO po_user;
 
--
-- Name: lens_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE lens_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.lens_id_sequence OWNER TO po_user;
 
--
-- Name: lens_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE lens_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    variation CHARACTER VARYING(100),
    min_focal_length INTEGER NOT NULL,
    max_focal_length INTEGER NOT NULL,
    min_aperture INTEGER NOT NULL,
    max_aperture INTEGER NOT NULL,
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.lens_type OWNER TO po_user;
 
--
-- Name: lens_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE lens_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.lens_type_id_sequence OWNER TO po_user;
 
--
-- Name: location; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE "location" (
    identifier INTEGER NOT NULL,
    place CHARACTER VARYING(300),
    state INTEGER,
    country INTEGER,
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    users INTEGER,
    city CHARACTER VARYING(300),
    latitude CHARACTER VARYING(10),
    longitude CHARACTER VARYING(10),
    private BOOLEAN NOT NULL
);
 
 
ALTER TABLE public."location" OWNER TO po_user;
 
--
-- Name: location_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE location_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.location_id_sequence OWNER TO po_user;
 
--
-- Name: manufacturer; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE manufacturer (
    identifier INTEGER NOT NULL,
    name CHARACTER VARYING(100),
    url CHARACTER VARYING(100),
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.manufacturer OWNER TO po_user;
 
--
-- Name: manufacturer_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE manufacturer_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.manufacturer_id_sequence OWNER TO po_user;
 
--
-- Name: orientations; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE orientations (
    identifier INTEGER NOT NULL,
    name CHARACTER VARYING(100),
    im_transform CHARACTER VARYING(100)
);
 
 
ALTER TABLE public.orientations OWNER TO po_user;
 
--
-- Name: orientations_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE orientations_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.orientations_id_sequence OWNER TO po_user;
 
--
-- Name: paper; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE paper (
    identifier INTEGER NOT NULL,
    name CHARACTER VARYING(300),
    size_x DOUBLE PRECISION,
    size_y DOUBLE PRECISION,
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.paper OWNER TO po_user;
 
--
-- Name: paper_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE paper_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.paper_id_sequence OWNER TO po_user;
 
--
-- Name: photo; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo (
    identifier INTEGER NOT NULL,
    users INTEGER NOT NULL,
    folder INTEGER NOT NULL,
    "location" INTEGER NOT NULL,
    caption text,
    date_of_exposure TIMESTAMP WITHOUT TIME zone,
    access_rights INTEGER NOT NULL,
    views INTEGER,
    copyright_statement text,
    hide_original CHARACTER(1),
    author text,
    title text,
    caption_writer text,
    category CHARACTER VARYING(3),
    credit text,
    SOURCE text,
    headline text,
    instructions text,
    transmission_reference text,
    supplemental_category text,
    web_statement text,
    CONSTRAINT photo_hide_original_check CHECK (((hide_original = 't'::bpchar) OR (hide_original = 'f'::bpchar)))
);
 
 
ALTER TABLE public.photo OWNER TO po_user;
 
--
-- Name: photo_dupe; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo_dupe (
    identifier INTEGER NOT NULL,
    "key" INTEGER NOT NULL,
    photo INTEGER NOT NULL,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    storage_location CHARACTER VARYING(50),
    storage_index CHARACTER VARYING(10),
    remark text
);
 
 
ALTER TABLE public.photo_dupe OWNER TO po_user;
 
--
-- Name: photo_dupe_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE photo_dupe_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.photo_dupe_id_sequence OWNER TO po_user;
 
--
-- Name: photo_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE photo_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.photo_id_sequence OWNER TO po_user;
 
--
-- Name: photo_item; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo_item (
    identifier INTEGER NOT NULL,
    photo INTEGER NOT NULL,
    shop_item INTEGER NOT NULL,
    price NUMERIC,
    currency INTEGER,
    "comment" text,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    date_of_last_edit TIMESTAMP WITHOUT TIME zone,
    deleted CHARACTER(1),
    CONSTRAINT photo_item_deleted_check CHECK (((deleted = 't'::bpchar) OR (deleted = 'f'::bpchar)))
);
 
 
ALTER TABLE public.photo_item OWNER TO po_user;
 
--
-- Name: photo_item_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE photo_item_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.photo_item_id_sequence OWNER TO po_user;
 
--
-- Name: photo_keywords; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo_keywords (
    photo INTEGER NOT NULL,
    keyword text NOT NULL
);
 
 
ALTER TABLE public.photo_keywords OWNER TO po_user;
 
--
-- Name: photo_spooler; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo_spooler (
    identifier INTEGER NOT NULL,
    users INTEGER,
    photo INTEGER
);
 
 
ALTER TABLE public.photo_spooler OWNER TO po_user;
 
--
-- Name: photo_spooler_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE photo_spooler_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.photo_spooler_id_sequence OWNER TO po_user;
 
--
-- Name: photo_tech; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo_tech (
    identifier INTEGER NOT NULL,
    photo INTEGER NOT NULL,
    camera INTEGER,
    lens INTEGER,
    film INTEGER,
    flash INTEGER,
    scanner INTEGER,
    FILTER INTEGER,
    scan_resolution INTEGER,
    aperture INTEGER,
    focal_length INTEGER,
    shutter INTEGER,
    camera_metering INTEGER,
    camera_program INTEGER,
    flash_mode INTEGER,
    exposure_comp INTEGER,
    flash_comp INTEGER,
    ev_difference INTEGER,
    iso_override INTEGER,
    support INTEGER,
    scan_bitdepth INTEGER,
    scan_multiscan INTEGER,
    exif text,
    iptc text
);
 
 
ALTER TABLE public.photo_tech OWNER TO po_user;
 
--
-- Name: photo_tech_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE photo_tech_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.photo_tech_id_sequence OWNER TO po_user;
 
--
-- Name: photo_version; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE photo_version (
    identifier INTEGER NOT NULL,
    "key" INTEGER NOT NULL,
    photo INTEGER NOT NULL,
    master CHARACTER(1),
    small_image_path CHARACTER VARYING(500),
    medium_image_path CHARACTER VARYING(500),
    large_image_path CHARACTER VARYING(500),
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    "comment" text,
    original_image_name CHARACTER VARYING(500),
    colorspace INTEGER NOT NULL,
    orientation INTEGER NOT NULL,
    CONSTRAINT photo_version_master_check CHECK (((master = 't'::bpchar) OR (master = 'f'::bpchar)))
);
 
 
ALTER TABLE public.photo_version OWNER TO po_user;
 
--
-- Name: photo_version_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE photo_version_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.photo_version_id_sequence OWNER TO po_user;
 
--
-- Name: preferences; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE preferences (
    identifier INTEGER NOT NULL,
    print_out CHARACTER(3),
    start_hour INTEGER,
    end_hour INTEGER,
    start_day INTEGER,
    num_of_rows INTEGER,
    num_of_columns INTEGER,
    folder_view CHARACTER(5),
    num_of_rows_l INTEGER,
    bulk_upload_enable CHARACTER(1),
    paper INTEGER,
    label INTEGER,
    shop_enable CHARACTER(1),
    popup_enable CHARACTER(1),
    popup_delay INTEGER,
    quota_size INTEGER,
    quota_count INTEGER,
    search_enable_stemming CHARACTER(1),
    search_default_mode INTEGER,
    download_counter INTEGER,
    download_expiry_period INTEGER,
    CONSTRAINT preferences_bulk_upload_enable_check CHECK (((bulk_upload_enable = 't'::bpchar) OR (bulk_upload_enable = 'f'::bpchar))),
    CONSTRAINT preferences_folder_view_check CHECK (((folder_view = 'slide'::bpchar) OR (folder_view = 'list'::bpchar))),
    CONSTRAINT preferences_print_out_check CHECK (((print_out = 'ps'::bpchar) OR (print_out = 'pdf'::bpchar))),
    CONSTRAINT preferences_search_enable_stemming_check CHECK (((search_enable_stemming = 't'::bpchar) OR (search_enable_stemming = 'f'::bpchar))),
    CONSTRAINT preferences_shop_enable_check CHECK (((shop_enable = 't'::bpchar) OR (shop_enable = 'f'::bpchar))),
    CONSTRAINT preferences_shop_enable_check1 CHECK (((shop_enable = 't'::bpchar) OR (shop_enable = 'f'::bpchar))),
    CONSTRAINT preferences_start_day_check CHECK (((start_day = 1) OR (start_day = 0))),
    CONSTRAINT preferences_start_hour_check CHECK (((start_hour >= 0) AND (start_hour < 24))),
    CONSTRAINT preferences_start_hour_check1 CHECK (((start_hour >= 0) AND (start_hour < 24)))
);
 
 
ALTER TABLE public.preferences OWNER TO po_user;
 
--
-- Name: preferences_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE preferences_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.preferences_id_sequence OWNER TO po_user;
 
--
-- Name: print_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE print_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.print_id_sequence OWNER TO po_user;
 
--
-- Name: rating; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE rating (
    identifier INTEGER NOT NULL,
    photo INTEGER NOT NULL,
    users INTEGER NOT NULL,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    VALUE INTEGER NOT NULL,
    "comment" text
);
 
 
ALTER TABLE public.rating OWNER TO po_user;
 
--
-- Name: rating_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE rating_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.rating_id_sequence OWNER TO po_user;
 
--
-- Name: scan_bitdepth; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE scan_bitdepth (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(6)
);
 
 
ALTER TABLE public.scan_bitdepth OWNER TO po_user;
 
--
-- Name: scan_bitdepth_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE scan_bitdepth_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.scan_bitdepth_id_sequence OWNER TO po_user;
 
--
-- Name: scan_multiscan; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE scan_multiscan (
    identifier INTEGER NOT NULL,
    VALUE INTEGER
);
 
 
ALTER TABLE public.scan_multiscan OWNER TO po_user;
 
--
-- Name: scan_multiscan_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE scan_multiscan_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.scan_multiscan_id_sequence OWNER TO po_user;
 
--
-- Name: scan_resolution; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE scan_resolution (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(6)
);
 
 
ALTER TABLE public.scan_resolution OWNER TO po_user;
 
--
-- Name: scan_resolution_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE scan_resolution_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.scan_resolution_id_sequence OWNER TO po_user;
 
--
-- Name: scanner; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE scanner (
    identifier INTEGER NOT NULL,
    "type" INTEGER NOT NULL,
    users INTEGER NOT NULL,
    serial_number CHARACTER VARYING(20),
    date_of_purchase TIMESTAMP WITHOUT TIME zone,
    purchased_new CHARACTER(1),
    access_rights INTEGER NOT NULL,
    CONSTRAINT scanner_purchased_new_check CHECK (((purchased_new = 't'::bpchar) OR (purchased_new = 'f'::bpchar)))
);
 
 
ALTER TABLE public.scanner OWNER TO po_user;
 
--
-- Name: scanner_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE scanner_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.scanner_id_sequence OWNER TO po_user;
 
--
-- Name: scanner_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE scanner_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    variation CHARACTER VARYING(100),
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.scanner_type OWNER TO po_user;
 
--
-- Name: scanner_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE scanner_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.scanner_type_id_sequence OWNER TO po_user;
 
--
-- Name: shop_category; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shop_category (
    identifier INTEGER NOT NULL,
    users INTEGER NOT NULL,
    caption CHARACTER VARYING(300),
    date_of_creation TIMESTAMP WITHOUT TIME zone
);
 
 
ALTER TABLE public.shop_category OWNER TO po_user;
 
--
-- Name: shop_category_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shop_category_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shop_category_id_sequence OWNER TO po_user;
 
--
-- Name: shop_item; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shop_item (
    identifier INTEGER NOT NULL,
    users INTEGER,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    date_of_last_edit TIMESTAMP WITHOUT TIME zone,
    description CHARACTER VARYING(200),
    category INTEGER NOT NULL
);
 
 
ALTER TABLE public.shop_item OWNER TO po_user;
 
--
-- Name: shop_item_generator_rule; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shop_item_generator_rule (
    identifier INTEGER NOT NULL,
    users INTEGER NOT NULL,
    shop_item INTEGER NOT NULL,
    price NUMERIC,
    currency INTEGER,
    "comment" text,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    date_of_last_edit TIMESTAMP WITHOUT TIME zone
);
 
 
ALTER TABLE public.shop_item_generator_rule OWNER TO po_user;
 
--
-- Name: shop_item_generator_rule_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shop_item_generator_rule_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shop_item_generator_rule_id_sequence OWNER TO po_user;
 
--
-- Name: shop_item_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shop_item_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shop_item_id_sequence OWNER TO po_user;
 
--
-- Name: shop_order; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shop_order (
    identifier INTEGER NOT NULL,
    client INTEGER,
    "transaction" INTEGER,
    item INTEGER NOT NULL,
    pieces NUMERIC,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    date_of_last_edit TIMESTAMP WITHOUT TIME zone,
    download_counter INTEGER,
    download_expiry_date DATE
);
 
 
ALTER TABLE public.shop_order OWNER TO po_user;
 
--
-- Name: shop_order_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shop_order_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shop_order_id_sequence OWNER TO po_user;
 
--
-- Name: shop_transaction; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shop_transaction (
    identifier INTEGER NOT NULL,
    STATUS INTEGER NOT NULL,
    remark text,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    date_of_last_edit TIMESTAMP WITHOUT TIME zone
);
 
 
ALTER TABLE public.shop_transaction OWNER TO po_user;
 
--
-- Name: shop_transaction_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shop_transaction_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shop_transaction_id_sequence OWNER TO po_user;
 
--
-- Name: shop_transaction_status; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shop_transaction_status (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(15)
);
 
 
ALTER TABLE public.shop_transaction_status OWNER TO po_user;
 
--
-- Name: shop_transaction_status_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shop_transaction_status_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shop_transaction_status_id_sequence OWNER TO po_user;
 
--
-- Name: shutter; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE shutter (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(10)
);
 
 
ALTER TABLE public.shutter OWNER TO po_user;
 
--
-- Name: shutter_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE shutter_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.shutter_id_sequence OWNER TO po_user;
 
--
-- Name: state; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE state (
    identifier INTEGER NOT NULL,
    code CHARACTER VARYING(5),
    VALUE CHARACTER VARYING(40)
);
 
 
ALTER TABLE public.state OWNER TO po_user;
 
--
-- Name: state_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE state_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.state_id_sequence OWNER TO po_user;
 
--
-- Name: submission; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE submission (
    identifier INTEGER NOT NULL,
    photo_dupe INTEGER NOT NULL,
    STATUS INTEGER NOT NULL,
    users INTEGER,
    date_of_creation TIMESTAMP WITHOUT TIME zone,
    remark text
);
 
 
ALTER TABLE public.submission OWNER TO po_user;
 
--
-- Name: submission_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE submission_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.submission_id_sequence OWNER TO po_user;
 
--
-- Name: submission_status; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE submission_status (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(10)
);
 
 
ALTER TABLE public.submission_status OWNER TO po_user;
 
--
-- Name: submission_status_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE submission_status_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.submission_status_id_sequence OWNER TO po_user;
 
--
-- Name: support; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE support (
    identifier INTEGER NOT NULL,
    "type" INTEGER NOT NULL,
    users INTEGER NOT NULL,
    serial_number CHARACTER VARYING(20),
    date_of_purchase TIMESTAMP WITHOUT TIME zone,
    purchased_new CHARACTER(1),
    access_rights INTEGER NOT NULL,
    CONSTRAINT support_purchased_new_check CHECK (((purchased_new = 't'::bpchar) OR (purchased_new = 'f'::bpchar)))
);
 
 
ALTER TABLE public.support OWNER TO po_user;
 
--
-- Name: support_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE support_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.support_id_sequence OWNER TO po_user;
 
--
-- Name: support_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE support_type (
    identifier INTEGER NOT NULL,
    manufacturer INTEGER NOT NULL,
    model CHARACTER VARYING(100),
    variation CHARACTER VARYING(100),
    last_modified_date TIMESTAMP WITHOUT TIME zone,
    last_modifying_users INTEGER
);
 
 
ALTER TABLE public.support_type OWNER TO po_user;
 
--
-- Name: support_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE support_type_id_sequence
    START WITH 1
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.support_type_id_sequence OWNER TO po_user;
 
--
-- Name: system_preferences; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE system_preferences (
    identifier INTEGER NOT NULL,
    new_user_type INTEGER NOT NULL,
    new_user_bulk_upload_enable CHARACTER(1),
    new_user_paper INTEGER,
    new_user_label INTEGER,
    current_volume CHARACTER VARYING(500),
    volume_max_size INTEGER,
    new_user_shop_enable CHARACTER(1),
    new_user_quota_size INTEGER,
    new_user_quota_count INTEGER,
    new_user_shared CHARACTER(1),
    CONSTRAINT system_preferences_new_user_bulk_upload_enable_check CHECK (((new_user_bulk_upload_enable = 't'::bpchar) OR (new_user_bulk_upload_enable = 'f'::bpchar))),
    CONSTRAINT system_preferences_new_user_shared_check CHECK (((new_user_shared = 't'::bpchar) OR (new_user_shared = 'f'::bpchar))),
    CONSTRAINT system_preferences_new_user_shop_enable_check CHECK (((new_user_shop_enable = 't'::bpchar) OR (new_user_shop_enable = 'f'::bpchar)))
);
 
 
ALTER TABLE public.system_preferences OWNER TO po_user;
 
--
-- Name: user_type; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE user_type (
    identifier INTEGER NOT NULL,
    VALUE CHARACTER VARYING(15)
);
 
 
ALTER TABLE public.user_type OWNER TO po_user;
 
--
-- Name: user_type_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE user_type_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.user_type_id_sequence OWNER TO po_user;
 
--
-- Name: users; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE users (
    identifier INTEGER NOT NULL,
    first_name CHARACTER VARYING(50),
    last_name CHARACTER VARYING(50),
    company CHARACTER VARYING(50),
    username CHARACTER VARYING(30),
    "password" CHARACTER VARYING(30),
    session_id CHARACTER VARYING(32),
    contact INTEGER,
    member_since TIMESTAMP WITHOUT TIME zone,
    preferences INTEGER,
    "type" INTEGER NOT NULL,
    imagemagick_options INTEGER NOT NULL,
    shared CHARACTER(1),
    imagemagick_composite_options INTEGER NOT NULL,
    dcraw_options INTEGER NOT NULL,
    CONSTRAINT users_shared_check CHECK (((shared = 't'::bpchar) OR (shared = 'f'::bpchar)))
);
 
 
ALTER TABLE public.users OWNER TO po_user;
 
--
-- Name: users_id_sequence; Type: SEQUENCE; Schema: public; Owner: po_user
--
 
CREATE SEQUENCE users_id_sequence
    INCREMENT BY 1
    NO MAXVALUE
    NO MINVALUE
    CACHE 1;
 
 
ALTER TABLE public.users_id_sequence OWNER TO po_user;
 
--
-- Name: version; Type: TABLE; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE TABLE version (
    identifier INTEGER NOT NULL,
    description CHARACTER VARYING(300),
    major SMALLINT,
    minor SMALLINT,
    variation CHARACTER VARYING(1)
);
 
 
ALTER TABLE public.version OWNER TO po_user;
 
--
-- Name: view_camera; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_camera AS
    SELECT camera.identifier, manufacturer.name, camera_type.model, camera_type.variation, camera.serial_number, camera.users, camera.date_of_purchase, camera.purchased_new, manufacturer.url, access_type.VALUE AS access_rights, camera_type.raw_icc_profile FROM camera_type, camera, manufacturer, access_type WHERE (((camera_type.manufacturer = manufacturer.identifier) AND (camera_type.identifier = camera."type")) AND (camera.access_rights = access_type.identifier)) ORDER BY manufacturer.name, camera_type.model, camera_type.variation;
 
 
ALTER TABLE public.view_camera OWNER TO po_user;
 
--
-- Name: view_camera_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_camera_type AS
    SELECT camera_type.identifier, manufacturer.name, camera_type.model, camera_type.variation, manufacturer.url, camera_type.raw_icc_profile FROM camera_type, manufacturer WHERE (camera_type.manufacturer = manufacturer.identifier) ORDER BY manufacturer.name, camera_type.model, camera_type.variation;
 
 
ALTER TABLE public.view_camera_type OWNER TO po_user;
 
--
-- Name: view_client; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_client AS
    SELECT client.identifier, client.users, client.client, users.last_name, users.first_name, client.date_of_creation, client_status.VALUE, client.STATUS, users."type", client."trusted" FROM client, users, client_status WHERE ((client.client = users.identifier) AND (client.STATUS = client_status.identifier)) ORDER BY users.last_name, users.first_name;
 
 
ALTER TABLE public.view_client OWNER TO po_user;
 
--
-- Name: view_contact; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_contact AS
    SELECT client.identifier, client.users, client.client, users.last_name, users.first_name, client.date_of_creation, client_status.VALUE, client.STATUS FROM client, users, client_status WHERE ((client.client = users.identifier) AND (client.STATUS = client_status.identifier)) ORDER BY users.last_name, users.first_name;
 
 
ALTER TABLE public.view_contact OWNER TO po_user;
 
--
-- Name: view_contact_info; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_contact_info AS
    SELECT contact_info.identifier, contact_info.address1, contact_info.address2, contact_info.city, contact_info.zipcode, (SELECT state.VALUE FROM state WHERE (state.identifier = contact_info.state)) AS state, (SELECT country.VALUE FROM country WHERE (country.identifier = contact_info.country)) AS country, contact_info.phone, contact_info.email, contact_info.url FROM contact_info;
 
 
ALTER TABLE public.view_contact_info OWNER TO po_user;
 
--
-- Name: view_film; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_film AS
    SELECT film.identifier, manufacturer.name, film_type.model, film_iso.VALUE AS iso, film_format.VALUE AS format, film.users, manufacturer.url, access_type.VALUE AS access_rights FROM film_type, film, manufacturer, film_iso, film_format, access_type WHERE (((((film_type.manufacturer = manufacturer.identifier) AND (film_type.identifier = film."type")) AND (film_type.iso = film_iso.identifier)) AND (film_type.format = film_format.identifier)) AND (film.access_rights = access_type.identifier)) ORDER BY manufacturer.name, film_type.model, film_iso.VALUE;
 
 
ALTER TABLE public.view_film OWNER TO po_user;
 
--
-- Name: view_film_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_film_type AS
    SELECT film_type.identifier, manufacturer.name, film_type.model, film_iso.VALUE AS iso, film_format.VALUE AS format, manufacturer.url FROM film_type, manufacturer, film_iso, film_format WHERE (((film_type.manufacturer = manufacturer.identifier) AND (film_type.iso = film_iso.identifier)) AND (film_type.format = film_format.identifier)) ORDER BY manufacturer.name, film_type.model, film_iso.VALUE;
 
 
ALTER TABLE public.view_film_type OWNER TO po_user;
 
--
-- Name: view_filter; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_filter AS
    SELECT FILTER.identifier, manufacturer.name, filter_type.model, filter_type.variation, FILTER.users, FILTER.date_of_purchase, FILTER.purchased_new, manufacturer.url, access_type.VALUE AS access_rights, FILTER.serial_number FROM filter_type, FILTER, manufacturer, access_type WHERE (((filter_type.manufacturer = manufacturer.identifier) AND (filter_type.identifier = FILTER."type")) AND (FILTER.access_rights = access_type.identifier)) ORDER BY manufacturer.name, filter_type.model, filter_type.variation;
 
 
ALTER TABLE public.view_filter OWNER TO po_user;
 
--
-- Name: view_filter_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_filter_type AS
    SELECT filter_type.identifier, manufacturer.name, filter_type.model, filter_type.variation, manufacturer.url FROM filter_type, manufacturer WHERE (filter_type.manufacturer = manufacturer.identifier) ORDER BY manufacturer.name, filter_type.model, filter_type.variation;
 
 
ALTER TABLE public.view_filter_type OWNER TO po_user;
 
--
-- Name: view_flash; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_flash AS
    SELECT flash.identifier, manufacturer.name, flash_type.model, flash_type.variation, flash.serial_number, flash.users, flash.date_of_purchase, flash.purchased_new, manufacturer.url, access_type.VALUE AS access_rights FROM flash_type, flash, manufacturer, access_type WHERE (((flash_type.manufacturer = manufacturer.identifier) AND (flash_type.identifier = flash."type")) AND (flash.access_rights = access_type.identifier)) ORDER BY manufacturer.name, flash_type.model, flash_type.variation;
 
 
ALTER TABLE public.view_flash OWNER TO po_user;
 
--
-- Name: view_flash_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_flash_type AS
    SELECT flash_type.identifier, manufacturer.name, flash_type.model, flash_type.variation, manufacturer.url FROM flash_type, manufacturer WHERE (flash_type.manufacturer = manufacturer.identifier) ORDER BY manufacturer.name, flash_type.model, flash_type.variation;
 
 
ALTER TABLE public.view_flash_type OWNER TO po_user;
 
--
-- Name: view_lens; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_lens AS
    SELECT lens.identifier, manufacturer.name, lens_type.model, lens_type.variation, t_min_aperture.s_min_aperture, t_max_aperture.s_max_aperture, t_min_focal_length.s_min_focal_length, t_max_focal_length.s_max_focal_length, lens.serial_number, lens.users, lens.date_of_purchase, lens.purchased_new, manufacturer.url, access_type.VALUE AS access_rights FROM lens_type, lens, manufacturer, access_type, (SELECT focal_length.identifier, focal_length.VALUE AS s_min_focal_length FROM focal_length) t_min_focal_length, (SELECT focal_length.identifier, focal_length.VALUE AS s_max_focal_length FROM focal_length) t_max_focal_length, (SELECT aperture.identifier, aperture.VALUE AS s_min_aperture FROM aperture) t_min_aperture, (SELECT aperture.identifier, aperture.VALUE AS s_max_aperture FROM aperture) t_max_aperture WHERE (((((((lens_type.manufacturer = manufacturer.identifier) AND (lens_type.identifier = lens."type")) AND (lens_type.min_focal_length = t_min_focal_length.identifier)) AND (lens_type.max_focal_length = t_max_focal_length.identifier)) AND (lens_type.min_aperture = t_min_aperture.identifier)) AND (lens_type.max_aperture = t_max_aperture.identifier)) AND (lens.access_rights = access_type.identifier)) ORDER BY manufacturer.name, t_min_focal_length.s_min_focal_length, lens_type.model, lens_type.variation;
 
 
ALTER TABLE public.view_lens OWNER TO po_user;
 
--
-- Name: view_lens_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_lens_type AS
    SELECT lens_type.identifier, manufacturer.name, lens_type.model, lens_type.variation, t_min_aperture.s_min_aperture, t_max_aperture.s_max_aperture, t_min_focal_length.s_min_focal_length, t_max_focal_length.s_max_focal_length, manufacturer.url FROM lens_type, manufacturer, (SELECT focal_length.identifier, focal_length.VALUE AS s_min_focal_length FROM focal_length) t_min_focal_length, (SELECT focal_length.identifier, focal_length.VALUE AS s_max_focal_length FROM focal_length) t_max_focal_length, (SELECT aperture.identifier, aperture.VALUE AS s_min_aperture FROM aperture) t_min_aperture, (SELECT aperture.identifier, aperture.VALUE AS s_max_aperture FROM aperture) t_max_aperture WHERE (((((lens_type.manufacturer = manufacturer.identifier) AND (lens_type.min_focal_length = t_min_focal_length.identifier)) AND (lens_type.max_focal_length = t_max_focal_length.identifier)) AND (lens_type.min_aperture = t_min_aperture.identifier)) AND (lens_type.max_aperture = t_max_aperture.identifier)) ORDER BY manufacturer.name, t_min_focal_length.s_min_focal_length, lens_type.model, lens_type.variation;
 
 
ALTER TABLE public.view_lens_type OWNER TO po_user;
 
--
-- Name: view_location; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_location AS
    SELECT "location".identifier, "location".place, "location".city, (SELECT state.VALUE FROM state WHERE (state.identifier = "location".state)) AS state, (SELECT country.VALUE FROM country WHERE (country.identifier = "location".country)) AS country, "location".users, "location".last_modified_date, "location".latitude, "location".longitude, "location".private FROM "location";
 
 
ALTER TABLE public.view_location OWNER TO po_user;
 
--
-- Name: view_photo; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_photo AS
    SELECT photo.identifier, photo.caption, photo.users, photo.date_of_exposure, photo_dupe.date_of_creation, photo_dupe.storage_location, photo_dupe.storage_index, photo_version.small_image_path, photo_version.medium_image_path, photo_version.large_image_path, photo.folder, access_type.VALUE AS access_rights FROM photo, photo_dupe, photo_version, access_type WHERE (((photo.identifier = photo_version.photo) AND (photo.identifier = photo_dupe.photo)) AND (photo.access_rights = access_type.identifier)) ORDER BY photo.identifier;
 
 
ALTER TABLE public.view_photo OWNER TO po_user;
 
--
-- Name: view_random_photo; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_random_photo AS
    SELECT photo_version.small_image_path, photo_version.medium_image_path, photo_version.large_image_path FROM photo, photo_version WHERE ((photo.identifier = photo_version.photo) AND (photo.identifier = (SELECT ((random() * (count_photos())::DOUBLE PRECISION))::INTEGER AS int4)));
 
 
ALTER TABLE public.view_random_photo OWNER TO po_user;
 
--
-- Name: view_rating; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_rating AS
    SELECT rating.identifier, rating.photo, rating.users, rating.date_of_creation, rating.VALUE, users.first_name, users.last_name, rating."comment" FROM rating, users WHERE (rating.users = users.identifier);
 
 
ALTER TABLE public.view_rating OWNER TO po_user;
 
--
-- Name: view_scanner; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_scanner AS
    SELECT scanner.identifier, manufacturer.name, scanner_type.model, scanner_type.variation, scanner.serial_number, scanner.users, scanner.date_of_purchase, scanner.purchased_new, manufacturer.url, access_type.VALUE AS access_rights FROM scanner_type, scanner, manufacturer, access_type WHERE (((scanner_type.manufacturer = manufacturer.identifier) AND (scanner_type.identifier = scanner."type")) AND (scanner.access_rights = access_type.identifier)) ORDER BY manufacturer.name, scanner_type.model, scanner_type.variation;
 
 
ALTER TABLE public.view_scanner OWNER TO po_user;
 
--
-- Name: view_scanner_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_scanner_type AS
    SELECT scanner_type.identifier, manufacturer.name, scanner_type.model, scanner_type.variation, manufacturer.url FROM scanner_type, manufacturer WHERE (scanner_type.manufacturer = manufacturer.identifier) ORDER BY manufacturer.name, scanner_type.model, scanner_type.variation;
 
 
ALTER TABLE public.view_scanner_type OWNER TO po_user;
 
--
-- Name: view_shop_item_generator_rule; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_shop_item_generator_rule AS
    SELECT shop_item_generator_rule.identifier, shop_category.caption AS shop_category, shop_item.description AS shop_item, currency.alpha_code AS currency, shop_item_generator_rule.price, shop_item_generator_rule."comment", shop_item_generator_rule.date_of_creation, shop_item_generator_rule.date_of_last_edit, shop_item_generator_rule.users FROM shop_item_generator_rule, shop_category, shop_item, currency WHERE (((shop_item_generator_rule.shop_item = shop_item.identifier) AND (shop_item.category = shop_category.identifier)) AND (shop_item_generator_rule.currency = currency.identifier)) ORDER BY shop_item_generator_rule.date_of_creation;
 
 
ALTER TABLE public.view_shop_item_generator_rule OWNER TO po_user;
 
--
-- Name: view_submission; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_submission AS
    SELECT submission.identifier, submission.photo_dupe, photo_dupe.photo, photo_dupe."key", (SELECT users.identifier FROM users WHERE (users.identifier = submission.users)) AS uidentifier, (SELECT users.first_name FROM users WHERE (users.identifier = submission.users)) AS first_name, (SELECT users.last_name FROM users WHERE (users.identifier = submission.users)) AS last_name, submission_status.VALUE, submission.date_of_creation, submission.remark FROM submission, photo_dupe, submission_status WHERE ((submission.photo_dupe = photo_dupe.identifier) AND (submission.STATUS = submission_status.identifier)) ORDER BY submission.date_of_creation, (SELECT users.last_name FROM users WHERE (users.identifier = submission.users)), (SELECT users.first_name FROM users WHERE (users.identifier = submission.users));
 
 
ALTER TABLE public.view_submission OWNER TO po_user;
 
--
-- Name: view_support; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_support AS
    SELECT support.identifier, manufacturer.name, support_type.model, support_type.variation, support.serial_number, support.users, support.date_of_purchase, support.purchased_new, manufacturer.url, access_type.VALUE AS access_rights FROM support_type, support, manufacturer, access_type WHERE (((support_type.manufacturer = manufacturer.identifier) AND (support_type.identifier = support."type")) AND (support.access_rights = access_type.identifier)) ORDER BY manufacturer.name, support_type.model, support_type.variation;
 
 
ALTER TABLE public.view_support OWNER TO po_user;
 
--
-- Name: view_support_type; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_support_type AS
    SELECT support_type.identifier, manufacturer.name, support_type.model, support_type.variation, manufacturer.url FROM support_type, manufacturer WHERE (support_type.manufacturer = manufacturer.identifier) ORDER BY manufacturer.name, support_type.model, support_type.variation;
 
 
ALTER TABLE public.view_support_type OWNER TO po_user;
 
--
-- Name: view_users_subscribed_to; Type: VIEW; Schema: public; Owner: po_user
--
 
CREATE VIEW view_users_subscribed_to AS
    SELECT client.identifier, client.users, client.client, users.last_name, users.first_name, client.date_of_creation, client_status.VALUE, client.STATUS FROM client, users, client_status WHERE ((client.users = users.identifier) AND (client.STATUS = client_status.identifier)) ORDER BY users.last_name, users.first_name;
 
 
ALTER TABLE public.view_users_subscribed_to OWNER TO po_user;
 
--
-- Name: access_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY access_type
    ADD CONSTRAINT access_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: album_content_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY album_content
    ADD CONSTRAINT album_content_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: album_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY album
    ADD CONSTRAINT album_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: aperture_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY aperture
    ADD CONSTRAINT aperture_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: calendar_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY calendar
    ADD CONSTRAINT calendar_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: camera_metering_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY camera_metering
    ADD CONSTRAINT camera_metering_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: camera_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY camera
    ADD CONSTRAINT camera_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: camera_program_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY camera_program
    ADD CONSTRAINT camera_program_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: camera_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY camera_type
    ADD CONSTRAINT camera_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: client_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY client
    ADD CONSTRAINT client_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: client_status_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY client_status
    ADD CONSTRAINT client_status_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: contact_info_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY contact_info
    ADD CONSTRAINT contact_info_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: country_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY country
    ADD CONSTRAINT country_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: currency_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY currency
    ADD CONSTRAINT currency_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: dcraw_options_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY dcraw_options
    ADD CONSTRAINT dcraw_options_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: ev_comp_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY ev_comp
    ADD CONSTRAINT ev_comp_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: film_format_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY film_format
    ADD CONSTRAINT film_format_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: film_iso_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY film_iso
    ADD CONSTRAINT film_iso_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: film_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY film
    ADD CONSTRAINT film_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: film_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY film_type
    ADD CONSTRAINT film_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: filter_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY FILTER
    ADD CONSTRAINT filter_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: filter_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY filter_type
    ADD CONSTRAINT filter_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: flash_mode_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY flash_mode
    ADD CONSTRAINT flash_mode_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: flash_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY flash
    ADD CONSTRAINT flash_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: flash_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY flash_type
    ADD CONSTRAINT flash_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: focal_length_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY focal_length
    ADD CONSTRAINT focal_length_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: folder_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY folder
    ADD CONSTRAINT folder_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: imagemagick_composite_options_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY imagemagick_composite_options
    ADD CONSTRAINT imagemagick_composite_options_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: imagemagick_options_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY imagemagick_options
    ADD CONSTRAINT imagemagick_options_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: label_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY label
    ADD CONSTRAINT label_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: lens_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY lens
    ADD CONSTRAINT lens_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: lens_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: location_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY "location"
    ADD CONSTRAINT location_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: manufacturer_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY manufacturer
    ADD CONSTRAINT manufacturer_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: orientations_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY orientations
    ADD CONSTRAINT orientations_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: paper_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY paper
    ADD CONSTRAINT paper_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: photo_dupe_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY photo_dupe
    ADD CONSTRAINT photo_dupe_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: photo_format_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shop_item
    ADD CONSTRAINT photo_format_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: photo_item_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY photo_item
    ADD CONSTRAINT photo_item_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: photo_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY photo
    ADD CONSTRAINT photo_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: photo_tech_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: photo_version_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY photo_version
    ADD CONSTRAINT photo_version_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY preferences
    ADD CONSTRAINT preferences_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: printer_spooler_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY photo_spooler
    ADD CONSTRAINT printer_spooler_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: rating_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY rating
    ADD CONSTRAINT rating_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: scan_bitdepth_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY scan_bitdepth
    ADD CONSTRAINT scan_bitdepth_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: scan_multiscan_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY scan_multiscan
    ADD CONSTRAINT scan_multiscan_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: scan_resolution_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY scan_resolution
    ADD CONSTRAINT scan_resolution_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: scanner_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY scanner
    ADD CONSTRAINT scanner_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: scanner_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY scanner_type
    ADD CONSTRAINT scanner_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: shop_category_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shop_category
    ADD CONSTRAINT shop_category_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: shop_item_generator_rule_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shop_item_generator_rule
    ADD CONSTRAINT shop_item_generator_rule_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: shop_order_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shop_order
    ADD CONSTRAINT shop_order_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: shop_transaction_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shop_transaction
    ADD CONSTRAINT shop_transaction_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: shop_transaction_status_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shop_transaction_status
    ADD CONSTRAINT shop_transaction_status_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: shutter_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY shutter
    ADD CONSTRAINT shutter_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: state_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY state
    ADD CONSTRAINT state_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: submission_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY submission
    ADD CONSTRAINT submission_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: submission_status_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY submission_status
    ADD CONSTRAINT submission_status_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: support_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY support
    ADD CONSTRAINT support_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: support_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY support_type
    ADD CONSTRAINT support_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: system_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY system_preferences
    ADD CONSTRAINT system_preferences_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: user_type_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY user_type
    ADD CONSTRAINT user_type_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: version_pkey; Type: CONSTRAINT; Schema: public; Owner: po_user; Tablespace: 
--
 
ALTER TABLE ONLY version
    ADD CONSTRAINT version_pkey PRIMARY KEY (identifier);
 
 
--
-- Name: album_content_album_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX album_content_album_idx ON album_content USING btree (album);
 
 
--
-- Name: album_content_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX album_content_id_idx ON album_content USING btree (identifier);
 
 
--
-- Name: album_content_photo_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX album_content_photo_idx ON album_content USING btree (photo);
 
 
--
-- Name: album_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX album_id_idx ON album USING btree (identifier);
 
 
--
-- Name: album_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX album_users_idx ON album USING btree (users);
 
 
--
-- Name: calendar_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX calendar_id_idx ON calendar USING btree (identifier);
 
 
--
-- Name: camera_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX camera_type_idx ON camera USING btree ("type");
 
 
--
-- Name: camera_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX camera_type_manufacturer_idx ON camera_type USING btree (manufacturer);
 
 
--
-- Name: camera_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX camera_users_idx ON camera USING btree (users);
 
 
--
-- Name: client_client_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX client_client_idx ON client USING btree (client);
 
 
--
-- Name: client_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX client_id_idx ON client USING btree (identifier);
 
 
--
-- Name: client_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX client_users_idx ON client USING btree (users);
 
 
--
-- Name: contact_info_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX contact_info_idx ON contact_info USING btree (identifier);
 
 
--
-- Name: film_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX film_type_idx ON film USING btree ("type");
 
 
--
-- Name: film_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX film_type_manufacturer_idx ON film_type USING btree (manufacturer);
 
 
--
-- Name: film_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX film_users_idx ON film USING btree (users);
 
 
--
-- Name: filter_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX filter_type_idx ON FILTER USING btree ("type");
 
 
--
-- Name: filter_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX filter_type_manufacturer_idx ON filter_type USING btree (manufacturer);
 
 
--
-- Name: filter_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX filter_users_idx ON FILTER USING btree (users);
 
 
--
-- Name: flash_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX flash_type_idx ON flash USING btree ("type");
 
 
--
-- Name: flash_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX flash_type_manufacturer_idx ON flash_type USING btree (manufacturer);
 
 
--
-- Name: flash_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX flash_users_idx ON flash USING btree (users);
 
 
--
-- Name: folder_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX folder_id_idx ON folder USING btree (identifier);
 
 
--
-- Name: folder_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX folder_users_idx ON folder USING btree (users);
 
 
--
-- Name: label_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX label_idx ON label USING btree (identifier);
 
 
--
-- Name: lens_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX lens_type_idx ON lens USING btree ("type");
 
 
--
-- Name: lens_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX lens_type_manufacturer_idx ON lens_type USING btree (manufacturer);
 
 
--
-- Name: lens_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX lens_users_idx ON lens USING btree (users);
 
 
--
-- Name: paper_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX paper_idx ON paper USING btree (identifier);
 
 
--
-- Name: photo_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_id_idx ON photo USING btree (identifier);
 
 
--
-- Name: photo_keywords_photo; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_keywords_photo ON photo_keywords USING btree (photo);
 
 
--
-- Name: photo_location_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_location_idx ON photo USING btree ("location");
 
 
--
-- Name: photo_tech_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_tech_id_idx ON photo_tech USING btree (identifier);
 
 
--
-- Name: photo_tech_photo_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_tech_photo_idx ON photo_tech USING btree (photo);
 
 
--
-- Name: photo_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_users_idx ON photo USING btree (users);
 
 
--
-- Name: photo_version_photo_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX photo_version_photo_idx ON photo_version USING btree (photo);
 
 
--
-- Name: rating_id_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX rating_id_idx ON rating USING btree (identifier);
 
 
--
-- Name: rating_photo_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX rating_photo_idx ON rating USING btree (photo);
 
 
--
-- Name: rating_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX rating_users_idx ON rating USING btree (users);
 
 
--
-- Name: scanner_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX scanner_type_idx ON scanner USING btree ("type");
 
 
--
-- Name: scanner_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX scanner_type_manufacturer_idx ON scanner_type USING btree (manufacturer);
 
 
--
-- Name: scanner_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX scanner_users_idx ON scanner USING btree (users);
 
 
--
-- Name: support_type_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX support_type_idx ON support USING btree ("type");
 
 
--
-- Name: support_type_manufacturer_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX support_type_manufacturer_idx ON support_type USING btree (manufacturer);
 
 
--
-- Name: support_users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX support_users_idx ON support USING btree (users);
 
 
--
-- Name: users_idx; Type: INDEX; Schema: public; Owner: po_user; Tablespace: 
--
 
CREATE INDEX users_idx ON users USING btree (identifier);
 
 
--
-- Name: album_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY album
    ADD CONSTRAINT album_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: album_content_album_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY album_content
    ADD CONSTRAINT album_content_album_fkey FOREIGN KEY (album) REFERENCES album(identifier);
 
 
--
-- Name: album_content_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY album_content
    ADD CONSTRAINT album_content_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: album_parent_album_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY album
    ADD CONSTRAINT album_parent_album_fkey FOREIGN KEY (parent_album) REFERENCES album(identifier);
 
 
--
-- Name: album_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY album
    ADD CONSTRAINT album_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: calendar_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY calendar
    ADD CONSTRAINT calendar_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: camera_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY camera
    ADD CONSTRAINT camera_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: camera_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY camera
    ADD CONSTRAINT camera_type_fkey FOREIGN KEY ("type") REFERENCES camera_type(identifier);
 
 
--
-- Name: camera_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY camera_type
    ADD CONSTRAINT camera_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: camera_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY camera_type
    ADD CONSTRAINT camera_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: camera_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY camera
    ADD CONSTRAINT camera_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: client_client_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY client
    ADD CONSTRAINT client_client_fkey FOREIGN KEY (client) REFERENCES users(identifier);
 
 
--
-- Name: client_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY client
    ADD CONSTRAINT client_status_fkey FOREIGN KEY (STATUS) REFERENCES client_status(identifier);
 
 
--
-- Name: client_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY client
    ADD CONSTRAINT client_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: contact_info_country_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY contact_info
    ADD CONSTRAINT contact_info_country_fkey FOREIGN KEY (country) REFERENCES country(identifier);
 
 
--
-- Name: contact_info_state_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY contact_info
    ADD CONSTRAINT contact_info_state_fkey FOREIGN KEY (state) REFERENCES state(identifier);
 
 
--
-- Name: film_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film
    ADD CONSTRAINT film_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: film_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film
    ADD CONSTRAINT film_type_fkey FOREIGN KEY ("type") REFERENCES film_type(identifier);
 
 
--
-- Name: film_type_format_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film_type
    ADD CONSTRAINT film_type_format_fkey FOREIGN KEY (format) REFERENCES film_format(identifier);
 
 
--
-- Name: film_type_iso_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film_type
    ADD CONSTRAINT film_type_iso_fkey FOREIGN KEY (iso) REFERENCES film_iso(identifier);
 
 
--
-- Name: film_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film_type
    ADD CONSTRAINT film_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: film_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film_type
    ADD CONSTRAINT film_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: film_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY film
    ADD CONSTRAINT film_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: filter_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY FILTER
    ADD CONSTRAINT filter_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: filter_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY FILTER
    ADD CONSTRAINT filter_type_fkey FOREIGN KEY ("type") REFERENCES filter_type(identifier);
 
 
--
-- Name: filter_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY filter_type
    ADD CONSTRAINT filter_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: filter_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY filter_type
    ADD CONSTRAINT filter_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: filter_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY FILTER
    ADD CONSTRAINT filter_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: flash_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY flash
    ADD CONSTRAINT flash_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: flash_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY flash
    ADD CONSTRAINT flash_type_fkey FOREIGN KEY ("type") REFERENCES flash_type(identifier);
 
 
--
-- Name: flash_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY flash_type
    ADD CONSTRAINT flash_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: flash_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY flash_type
    ADD CONSTRAINT flash_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: flash_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY flash
    ADD CONSTRAINT flash_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: folder_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY folder
    ADD CONSTRAINT folder_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: folder_parent_folder_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY folder
    ADD CONSTRAINT folder_parent_folder_fkey FOREIGN KEY (parent_folder) REFERENCES folder(identifier);
 
 
--
-- Name: folder_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY folder
    ADD CONSTRAINT folder_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: imagemagick_composite_options_photo_version_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY imagemagick_composite_options
    ADD CONSTRAINT imagemagick_composite_options_photo_version_fkey FOREIGN KEY (photo_version) REFERENCES photo_version(identifier);
 
 
--
-- Name: label_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY label
    ADD CONSTRAINT label_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: label_paper_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY label
    ADD CONSTRAINT label_paper_fkey FOREIGN KEY (paper) REFERENCES paper(identifier);
 
 
--
-- Name: label_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY label
    ADD CONSTRAINT label_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: lens_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens
    ADD CONSTRAINT lens_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: lens_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens
    ADD CONSTRAINT lens_type_fkey FOREIGN KEY ("type") REFERENCES lens_type(identifier);
 
 
--
-- Name: lens_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: lens_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: lens_type_max_aperture_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_max_aperture_fkey FOREIGN KEY (max_aperture) REFERENCES aperture(identifier);
 
 
--
-- Name: lens_type_max_focal_length_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_max_focal_length_fkey FOREIGN KEY (max_focal_length) REFERENCES focal_length(identifier);
 
 
--
-- Name: lens_type_min_aperture_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_min_aperture_fkey FOREIGN KEY (min_aperture) REFERENCES aperture(identifier);
 
 
--
-- Name: lens_type_min_focal_length_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens_type
    ADD CONSTRAINT lens_type_min_focal_length_fkey FOREIGN KEY (min_focal_length) REFERENCES focal_length(identifier);
 
 
--
-- Name: lens_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY lens
    ADD CONSTRAINT lens_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: location_country_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY "location"
    ADD CONSTRAINT location_country_fkey FOREIGN KEY (country) REFERENCES country(identifier);
 
 
--
-- Name: location_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY "location"
    ADD CONSTRAINT location_last_modifying_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: location_state_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY "location"
    ADD CONSTRAINT location_state_fkey FOREIGN KEY (state) REFERENCES state(identifier);
 
 
--
-- Name: manufacturer_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY manufacturer
    ADD CONSTRAINT manufacturer_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: paper_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY paper
    ADD CONSTRAINT paper_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: photo_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo
    ADD CONSTRAINT photo_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: photo_dupe_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_dupe
    ADD CONSTRAINT photo_dupe_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: photo_folder_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo
    ADD CONSTRAINT photo_folder_fkey FOREIGN KEY (folder) REFERENCES folder(identifier);
 
 
--
-- Name: photo_format_category_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_item
    ADD CONSTRAINT photo_format_category_fkey FOREIGN KEY (category) REFERENCES shop_category(identifier);
 
 
--
-- Name: photo_format_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_item
    ADD CONSTRAINT photo_format_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: photo_item_currency_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_item
    ADD CONSTRAINT photo_item_currency_fkey FOREIGN KEY (currency) REFERENCES currency(identifier);
 
 
--
-- Name: photo_item_format_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_item
    ADD CONSTRAINT photo_item_format_fkey FOREIGN KEY (shop_item) REFERENCES shop_item(identifier);
 
 
--
-- Name: photo_item_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_item
    ADD CONSTRAINT photo_item_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: photo_keywords_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_keywords
    ADD CONSTRAINT photo_keywords_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: photo_location_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo
    ADD CONSTRAINT photo_location_fkey FOREIGN KEY ("location") REFERENCES "location"(identifier);
 
 
--
-- Name: photo_tech_aperture_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_aperture_fkey FOREIGN KEY (aperture) REFERENCES aperture(identifier);
 
 
--
-- Name: photo_tech_camera_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_camera_fkey FOREIGN KEY (camera) REFERENCES camera(identifier);
 
 
--
-- Name: photo_tech_camera_metering_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_camera_metering_fkey FOREIGN KEY (camera_metering) REFERENCES camera_metering(identifier);
 
 
--
-- Name: photo_tech_camera_program_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_camera_program_fkey FOREIGN KEY (camera_program) REFERENCES camera_program(identifier);
 
 
--
-- Name: photo_tech_ev_difference_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_ev_difference_fkey FOREIGN KEY (ev_difference) REFERENCES ev_comp(identifier);
 
 
--
-- Name: photo_tech_exposure_comp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_exposure_comp_fkey FOREIGN KEY (exposure_comp) REFERENCES ev_comp(identifier);
 
 
--
-- Name: photo_tech_film_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_film_fkey FOREIGN KEY (film) REFERENCES film(identifier);
 
 
--
-- Name: photo_tech_filter_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_filter_fkey FOREIGN KEY (FILTER) REFERENCES FILTER(identifier);
 
 
--
-- Name: photo_tech_flash_comp_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_flash_comp_fkey FOREIGN KEY (flash_comp) REFERENCES ev_comp(identifier);
 
 
--
-- Name: photo_tech_flash_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_flash_fkey FOREIGN KEY (flash) REFERENCES flash(identifier);
 
 
--
-- Name: photo_tech_flash_mode_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_flash_mode_fkey FOREIGN KEY (flash_mode) REFERENCES flash_mode(identifier);
 
 
--
-- Name: photo_tech_focal_length_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_focal_length_fkey FOREIGN KEY (focal_length) REFERENCES focal_length(identifier);
 
 
--
-- Name: photo_tech_iso_override_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_iso_override_fkey FOREIGN KEY (iso_override) REFERENCES film_iso(identifier);
 
 
--
-- Name: photo_tech_lens_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_lens_fkey FOREIGN KEY (lens) REFERENCES lens(identifier);
 
 
--
-- Name: photo_tech_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: photo_tech_scan_bitdepth_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_scan_bitdepth_fkey FOREIGN KEY (scan_bitdepth) REFERENCES scan_bitdepth(identifier);
 
 
--
-- Name: photo_tech_scan_multiscan_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_scan_multiscan_fkey FOREIGN KEY (scan_multiscan) REFERENCES scan_multiscan(identifier);
 
 
--
-- Name: photo_tech_scan_resolution_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_scan_resolution_fkey FOREIGN KEY (scan_resolution) REFERENCES scan_resolution(identifier);
 
 
--
-- Name: photo_tech_scanner_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_scanner_fkey FOREIGN KEY (scanner) REFERENCES scanner(identifier);
 
 
--
-- Name: photo_tech_shutter_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_shutter_fkey FOREIGN KEY (shutter) REFERENCES shutter(identifier);
 
 
--
-- Name: photo_tech_support_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_tech
    ADD CONSTRAINT photo_tech_support_fkey FOREIGN KEY (support) REFERENCES support(identifier);
 
 
--
-- Name: photo_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo
    ADD CONSTRAINT photo_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: photo_version_orientation_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_version
    ADD CONSTRAINT photo_version_orientation_fkey FOREIGN KEY (orientation) REFERENCES orientations(identifier);
 
 
--
-- Name: photo_version_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_version
    ADD CONSTRAINT photo_version_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: preferences_label_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY preferences
    ADD CONSTRAINT preferences_label_fkey FOREIGN KEY (label) REFERENCES label(identifier);
 
 
--
-- Name: preferences_paper_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY preferences
    ADD CONSTRAINT preferences_paper_fkey FOREIGN KEY (paper) REFERENCES paper(identifier);
 
 
--
-- Name: printer_spooler_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_spooler
    ADD CONSTRAINT printer_spooler_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: printer_spooler_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY photo_spooler
    ADD CONSTRAINT printer_spooler_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: rating_photo_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY rating
    ADD CONSTRAINT rating_photo_fkey FOREIGN KEY (photo) REFERENCES photo(identifier);
 
 
--
-- Name: rating_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY rating
    ADD CONSTRAINT rating_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: scanner_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY scanner
    ADD CONSTRAINT scanner_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: scanner_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY scanner
    ADD CONSTRAINT scanner_type_fkey FOREIGN KEY ("type") REFERENCES scanner_type(identifier);
 
 
--
-- Name: scanner_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY scanner_type
    ADD CONSTRAINT scanner_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: scanner_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY scanner_type
    ADD CONSTRAINT scanner_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: scanner_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY scanner
    ADD CONSTRAINT scanner_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: shop_category_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_category
    ADD CONSTRAINT shop_category_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: shop_item_generator_rule_currency_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_item_generator_rule
    ADD CONSTRAINT shop_item_generator_rule_currency_fkey FOREIGN KEY (currency) REFERENCES currency(identifier);
 
 
--
-- Name: shop_item_generator_rule_shop_item_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_item_generator_rule
    ADD CONSTRAINT shop_item_generator_rule_shop_item_fkey FOREIGN KEY (shop_item) REFERENCES shop_item(identifier);
 
 
--
-- Name: shop_item_generator_rule_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_item_generator_rule
    ADD CONSTRAINT shop_item_generator_rule_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: shop_order_client_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_order
    ADD CONSTRAINT shop_order_client_fkey FOREIGN KEY (client) REFERENCES users(identifier);
 
 
--
-- Name: shop_order_item_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_order
    ADD CONSTRAINT shop_order_item_fkey FOREIGN KEY (item) REFERENCES photo_item(identifier);
 
 
--
-- Name: shop_order_transaction_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_order
    ADD CONSTRAINT shop_order_transaction_fkey FOREIGN KEY ("transaction") REFERENCES shop_transaction(identifier);
 
 
--
-- Name: shop_transaction_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY shop_transaction
    ADD CONSTRAINT shop_transaction_status_fkey FOREIGN KEY (STATUS) REFERENCES shop_transaction_status(identifier);
 
 
--
-- Name: submission_photo_dupe_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY submission
    ADD CONSTRAINT submission_photo_dupe_fkey FOREIGN KEY (photo_dupe) REFERENCES photo_dupe(identifier);
 
 
--
-- Name: submission_status_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY submission
    ADD CONSTRAINT submission_status_fkey FOREIGN KEY (STATUS) REFERENCES submission_status(identifier);
 
 
--
-- Name: submission_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY submission
    ADD CONSTRAINT submission_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: support_access_rights_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY support
    ADD CONSTRAINT support_access_rights_fkey FOREIGN KEY (access_rights) REFERENCES access_type(identifier);
 
 
--
-- Name: support_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY support
    ADD CONSTRAINT support_type_fkey FOREIGN KEY ("type") REFERENCES support_type(identifier);
 
 
--
-- Name: support_type_last_modifying_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY support_type
    ADD CONSTRAINT support_type_last_modifying_users_fkey FOREIGN KEY (last_modifying_users) REFERENCES users(identifier);
 
 
--
-- Name: support_type_manufacturer_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY support_type
    ADD CONSTRAINT support_type_manufacturer_fkey FOREIGN KEY (manufacturer) REFERENCES manufacturer(identifier);
 
 
--
-- Name: support_users_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY support
    ADD CONSTRAINT support_users_fkey FOREIGN KEY (users) REFERENCES users(identifier);
 
 
--
-- Name: system_preferences_new_user_label_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY system_preferences
    ADD CONSTRAINT system_preferences_new_user_label_fkey FOREIGN KEY (new_user_label) REFERENCES label(identifier);
 
 
--
-- Name: system_preferences_new_user_paper_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY system_preferences
    ADD CONSTRAINT system_preferences_new_user_paper_fkey FOREIGN KEY (new_user_paper) REFERENCES paper(identifier);
 
 
--
-- Name: system_preferences_new_user_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY system_preferences
    ADD CONSTRAINT system_preferences_new_user_type_fkey FOREIGN KEY (new_user_type) REFERENCES user_type(identifier);
 
 
--
-- Name: users_contact_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_contact_fkey FOREIGN KEY (contact) REFERENCES contact_info(identifier);
 
 
--
-- Name: users_dcraw_options_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_dcraw_options_fkey FOREIGN KEY (dcraw_options) REFERENCES dcraw_options(identifier);
 
 
--
-- Name: users_imagemagick_composite_options_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_imagemagick_composite_options_fkey FOREIGN KEY (imagemagick_composite_options) REFERENCES imagemagick_composite_options(identifier);
 
 
--
-- Name: users_imagemagick_options_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_imagemagick_options_fkey FOREIGN KEY (imagemagick_options) REFERENCES imagemagick_options(identifier);
 
 
--
-- Name: users_preferences_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_preferences_fkey FOREIGN KEY (preferences) REFERENCES preferences(identifier);
 
 
--
-- Name: users_type_fkey; Type: FK CONSTRAINT; Schema: public; Owner: po_user
--
 
ALTER TABLE ONLY users
    ADD CONSTRAINT users_type_fkey FOREIGN KEY ("type") REFERENCES user_type(identifier);
 
 
--
-- Name: public; Type: ACL; Schema: -; Owner: postgres
--
 
REVOKE ALL ON SCHEMA public FROM PUBLIC;
REVOKE ALL ON SCHEMA public FROM postgres;
GRANT ALL ON SCHEMA public TO postgres;
GRANT ALL ON SCHEMA public TO PUBLIC;
 
 
--
-- PostgreSQL database dump complete
--
podoc/schema-2.33c.txt · Last modified: 2007/04/20 10:03 by Luud