User Tools

Site Tools


podoc:rating_sql_table

Database Table Description of "rating"

Name

rating

Description

Purpose

Schema

create table rating (
  identifier            integer not null primary key,
  photo                 integer not null references photo(identifier),
  users                 integer not null references users(identifier),
  date_of_creation      timestamp,
  value                 integer not null,
  comment               text,
  version               integer not null references photo_version(identifier);
);

References tables

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

Is referenced by tables

None.

None.

History

Used first

Version 2.5

Used last

Still in use

Schema change history

= Version 2.5 =

CREATE TABLE rating (
  identifier            INTEGER NOT NULL PRIMARY KEY,
  photo                 INTEGER NOT NULL REFERENCES photo(identifier),
  users                 INTEGER NOT NULL REFERENCES users(identifier),
  date_of_creation      TIMESTAMP,
  VALUE                 INTEGER NOT NULL
);

= Version 2.6 =

ALTER TABLE rating ADD COLUMN comment text;

= Version 2.34 =

-- Add 'version' to rating to allow individual versions.
ALTER TABLE rating
  ADD version INTEGER REFERENCES photo_version(identifier);
ALTER TABLE rating ALTER version SET NOT NULL;
Data change history

= Version 2.34 =

-- Add 'version' to rating to allow individual versions.
UPDATE rating SET version =
   (SELECT identifier FROM photo_version v
    WHERE rating.photo = v.photo AND v.master = 't');
podoc/rating_sql_table.txt · Last modified: 2007/10/19 19:39 by Luud