User Tools

Site Tools


podoc:photo_format_sql_table

Database Table Description of "photo_format"

Dropped in 2.19. Replaced by shop_item.

Name

photo_format

Description

Purpose

Schema

CREATE TABLE photo_format (
  identifier            INTEGER NOT NULL PRIMARY KEY,
  users                 INTEGER REFERENCES users(identifier),
  width                 VARCHAR(100),
  height                VARCHAR(100),
  date_of_creation      TIMESTAMP,
  date_of_last_edit     TIMESTAMP
);

References tables

  • users references users(identifier)

Is referenced by tables

None.

None.

None.

None.

History

Used first

Version 2.8

Used last

Version 2.18

Schema change history

= Version 2.8 =

CREATE TABLE photo_format (
  identifier            INTEGER NOT NULL PRIMARY KEY,
  users                 INTEGER REFERENCES users(identifier),
  width                 VARCHAR(100),
  height                VARCHAR(100),
  date_of_creation      TIMESTAMP,
  date_of_last_edit     TIMESTAMP
);

= Version 2.19 =

ALTER TABLE photo_format ADD COLUMN description VARCHAR(200);
ALTER TABLE photo_format ADD COLUMN category INTEGER REFERENCES shop_category(identifier);
 
-- and migrate existing photo_formats to this category
UPDATE photo_format SET category = shop_category.identifier FROM shop_category WHERE photo_format.users = shop_category.users;
 
-- now that we have the categories updated set them not null
ALTER TABLE photo_format ALTER COLUMN category SET NOT NULL;
 
-- update the photo_format so that we have only one description field
UPDATE photo_format SET description = width || 'x' || height;
 
-- drop old columns from photo_format
ALTER TABLE photo_format DROP COLUMN width;
ALTER TABLE photo_format DROP COLUMN height;
 
ALTER TABLE photo_format RENAME TO shop_item;
Data change history
podoc/photo_format_sql_table.txt · Last modified: 2007/04/20 10:55 by Luud