User Tools

Site Tools


podoc:shop_item_sql_table

Database Table Description of "shop_item"

Name

shop_item

Description

Purpose

Schema

CREATE TABLE photo_format (
  identifier            INTEGER NOT NULL PRIMARY KEY,
  users                 INTEGER REFERENCES users(identifier),
  date_of_creation      TIMESTAMP,
  date_of_last_edit     TIMESTAMP,
  description           VARCHAR(200),
  category              INTEGER NOT NULL REFERENCES shop_category(identifier)
);

References tables

Is referenced by tables

None.

None.

None.

History

Used first

Version 2.19

Used last

Version 2.33

Schema change history

= 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;

= Version 2.34 =

DROP TABLE shop_item;
Data change history
podoc/shop_item_sql_table.txt · Last modified: 2007/10/19 15:51 by Luud