svnno****@sourc*****
svnno****@sourc*****
2007年 7月 23日 (月) 09:15:00 JST
Revision: 341 http://svn.sourceforge.jp/cgi-bin/viewcvs.cgi?root=pal&view=rev&rev=341 Author: takeharu Date: 2007-07-23 09:15:00 +0900 (Mon, 23 Jul 2007) Log Message: ----------- updated pompei db shema Modified Paths: -------------- pompei/trunk/src/main/webapp/WEB-INF/db/create_table.sql -------------- next part -------------- Modified: pompei/trunk/src/main/webapp/WEB-INF/db/create_table.sql =================================================================== --- pompei/trunk/src/main/webapp/WEB-INF/db/create_table.sql 2007-07-23 00:12:47 UTC (rev 340) +++ pompei/trunk/src/main/webapp/WEB-INF/db/create_table.sql 2007-07-23 00:15:00 UTC (rev 341) @@ -353,7 +353,8 @@ DROP TABLE products; CREATE TABLE products ( - products_id int NOT NULL, + products_id int NOT NULL GENERATED ALWAYS AS IDENTITY + (START WITH 1, INCREMENT BY 1), products_quantity int NOT NULL, products_model varchar(12), products_image varchar(64), @@ -367,11 +368,13 @@ manufacturers_id int, products_ordered int NOT NULL default 0, PRIMARY KEY (products_id) + FOREIGN KEY (manufacturers_id) REFERENCES manufacturers (manufacturers_id) ); DROP TABLE products_attributes; CREATE TABLE products_attributes ( - products_attributes_id int NOT NULL, + products_attributes_id int NOT NULL GENERATED ALWAYS AS IDENTITY + (START WITH 1, INCREMENT BY 1), products_id int NOT NULL, options_id int NOT NULL, options_values_id int NOT NULL, @@ -379,6 +382,9 @@ price_prefix char(1) NOT NULL, PRIMARY KEY (products_attributes_id) ); +ALTER TABLE products_attributes + ADD FOREIGN KEY (products_id) + REFERENCES products (products_id); DROP TABLE products_attributes_download; CREATE TABLE products_attributes_download ( @@ -397,9 +403,11 @@ products_description LONG VARCHAR, products_url varchar(255), products_viewed int default 0, - PRIMARY KEY (products_id,language_id) + PRIMARY KEY (products_id,language_id), + FOREIGN KEY (products_id) REFERENCES products (products_id) ); + DROP TABLE products_notifications; CREATE TABLE products_notifications ( products_id int NOT NULL, @@ -436,9 +444,12 @@ CREATE TABLE products_to_categories ( products_id int NOT NULL, categories_id int NOT NULL, - PRIMARY KEY (products_id,categories_id) + comment varchar(40), + PRIMARY KEY (products_id,categories_id), + FOREIGN KEY (products_id) REFERENCES products (products_id) ); + DROP TABLE reviews; CREATE TABLE reviews ( reviews_id int NOT NULL,