Index: /branches/comu-ver2/html/install/sql/create_table_mysql.sql
===================================================================
--- /branches/comu-ver2/html/install/sql/create_table_mysql.sql	(revision 18275)
+++ /branches/comu-ver2/html/install/sql/create_table_mysql.sql	(revision 18331)
@@ -1,5 +1,5 @@
 create table dtb_module_update_logs(
-    log_id int auto_increment primary key NOT NULL,
-    module_id int not null,
+    log_id int auto_increment NOT NULL,
+    module_id int NOT NULL,
     buckup_path text,
     error_flg smallint DEFAULT 0,
@@ -7,24 +7,26 @@
     ok text,
     create_date datetime NOT NULL,
-    update_date datetime NOT NULL
-) TYPE=InnoDB ;
+    update_date datetime NOT NULL,
+    PRIMARY KEY (log_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_ownersstore_settings (
     public_key text
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_kiyaku (
-    kiyaku_id int auto_increment primary key NOT NULL,
+    kiyaku_id int auto_increment NOT NULL,
     kiyaku_title text NOT NULL,
     kiyaku_text text NOT NULL,
     rank int NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     update_date datetime NOT NULL,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (kiyaku_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_holiday (
-    holiday_id int auto_increment primary key NOT NULL,
+    holiday_id int auto_increment NOT NULL,
     title text NOT NULL,
     month smallint NOT NULL,
@@ -34,6 +36,7 @@
     create_date datetime NOT NULL,
     update_date datetime NOT NULL,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (holiday_id)
+) TYPE=InnoDB;
 
 CREATE TABLE mtb_zip (
@@ -53,5 +56,5 @@
     flg5 text,
     flg6 text
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_bat_order_daily_age (
@@ -64,5 +67,5 @@
     order_date datetime,
     create_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_update (
@@ -78,9 +81,9 @@
     other_files text,
     del_flg smallint NOT NULL DEFAULT 0,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     update_date datetime,
     release_date datetime NOT NULL,
     PRIMARY KEY (module_id)
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_baseinfo (
@@ -144,8 +147,8 @@
     message text,
     regular_holiday_ids text
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_deliv (
-    deliv_id int auto_increment primary key NOT NULL,
+    deliv_id int auto_increment NOT NULL,
     name text,
     service_name text,
@@ -155,7 +158,8 @@
     del_flg smallint NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    PRIMARY KEY (deliv_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_delivtime (
@@ -164,15 +168,16 @@
     deliv_time text NOT NULL,
     PRIMARY KEY (deliv_id, time_id)
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_delivfee (
     deliv_id int NOT NULL,
-    fee_id int auto_increment primary key NOT NULL,
+    fee_id int auto_increment NOT NULL,
     fee text NOT NULL,
-    pref smallint
-) TYPE=InnoDB ;
+    pref smallint,
+    PRIMARY KEY (fee_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_payment (
-    payment_id int auto_increment primary key NOT NULL,
+    payment_id int auto_increment NOT NULL,
     payment_method text,
     charge numeric,
@@ -185,12 +190,12 @@
     del_flg smallint NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     update_date datetime,
     payment_image text,
     upper_rule numeric,
-    charge_flg int2 DEFAULT 1,
+    charge_flg smallint DEFAULT 1,
     rule_min numeric,
     upper_rule_max numeric,
-    module_id int4,
+    module_id int,
     module_path text,
     memo01 text,
@@ -203,6 +208,7 @@
     memo08 text,
     memo09 text,
-    memo10 text
-) TYPE=InnoDB ;
+    memo10 text,
+    PRIMARY KEY (payment_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_mailtemplate (
@@ -213,10 +219,10 @@
     creator_id int NOT NULL,
     del_flg smallint NOT NULL DEFAULT 0,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     update_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_mailmaga_template (
-    template_id int auto_increment primary key NOT NULL,
+    template_id int auto_increment NOT NULL,
     subject text,
     charge_image text,
@@ -243,10 +249,11 @@
     del_flg smallint NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    PRIMARY KEY (template_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_send_history (
-    send_id int auto_increment primary key NOT NULL,
+    send_id int auto_increment NOT NULL,
     mail_method smallint,
     subject text,
@@ -259,7 +266,8 @@
     del_flg smallint NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime NOT NULL
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime NOT NULL,
+    PRIMARY KEY (send_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_send_customer (
@@ -269,8 +277,8 @@
     name text,
     send_flag smallint
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_products (
-    product_id int auto_increment primary key NOT NULL,
+    product_id int auto_increment NOT NULL,
     name text,
     deliv_fee numeric,
@@ -326,11 +334,12 @@
     del_flg smallint NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime,
-    deliv_date_id int
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    deliv_date_id int,
+    PRIMARY KEY (product_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_products_class (
-    product_class_id int auto_increment primary key NOT NULL,
+    product_class_id int auto_increment NOT NULL,
     product_id int NOT NULL,
     classcategory_id1 int NOT NULL DEFAULT 0,
@@ -344,22 +353,24 @@
     status smallint,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    PRIMARY KEY (product_class_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_class (
-    class_id int auto_increment primary key NOT NULL,
+    class_id int auto_increment NOT NULL,
     name text,
     status smallint,
     rank int,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime,
-    del_flg smallint NOT NULL DEFAULT 0,
-    product_id int
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    del_flg smallint NOT NULL DEFAULT 0,
+    product_id int,
+    PRIMARY KEY (class_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_classcategory (
-    classcategory_id int auto_increment primary key NOT NULL,
+    classcategory_id int auto_increment NOT NULL,
     name text,
     class_id int NOT NULL,
@@ -367,11 +378,12 @@
     rank int,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (classcategory_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_category (
-    category_id int auto_increment primary key NOT NULL,
+    category_id int auto_increment NOT NULL,
     category_name text,
     parent_category_id int NOT NULL DEFAULT 0,
@@ -379,13 +391,14 @@
     rank int,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (category_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_product_categories (
-    product_id int4 NOT NULL,
-    category_id int4 NOT NULL,
-    rank int4 NOT NULL,
+    product_id int NOT NULL,
+    category_id int NOT NULL,
+    rank int NOT NULL,
     PRIMARY KEY(product_id, category_id)
 ) TYPE=InnoDB;
@@ -403,6 +416,6 @@
     total numeric NOT NULL DEFAULT 0,
     total_average numeric NOT NULL DEFAULT 0,
-    order_date datetime NOT NULL ,
-    create_date datetime NOT NULL ,
+    order_date datetime NOT NULL,
+    create_date datetime NOT NULL,
     year smallint NOT NULL,
     month smallint NOT NULL,
@@ -413,5 +426,5 @@
     key_year text NOT NULL,
     key_wday text NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_bat_order_daily_hour (
@@ -428,7 +441,7 @@
     total_average numeric NOT NULL DEFAULT 0,
     hour smallint NOT NULL DEFAULT 0,
-    order_date datetime ,
+    order_date datetime,
     create_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_recommend_products (
@@ -439,10 +452,10 @@
     status smallint NOT NULL DEFAULT 0,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     update_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_review (
-    review_id int auto_increment primary key NOT NULL,
+    review_id int auto_increment NOT NULL,
     product_id int NOT NULL,
     reviewer_name text NOT NULL,
@@ -457,6 +470,7 @@
     create_date datetime,
     update_date datetime,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (review_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_customer_reading (
@@ -465,5 +479,5 @@
     create_date datetime NOT NULL,
     update_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_customer_favorite_products (
@@ -472,5 +486,5 @@
     create_date datetime NOT NULL,
     update_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_category_count (
@@ -478,5 +492,5 @@
     product_count int NOT NULL,
     create_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_category_total_count (
@@ -484,8 +498,8 @@
     product_count int,
     create_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_news (
-    news_id int auto_increment primary key NOT NULL,
+    news_id int auto_increment NOT NULL,
     news_date datetime,
     rank int,
@@ -496,11 +510,12 @@
     link_method text,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (news_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_best_products (
-    best_id int auto_increment primary key NOT NULL,
+    best_id int auto_increment NOT NULL,
     category_id int NOT NULL,
     rank int NOT NULL DEFAULT 0,
@@ -509,11 +524,12 @@
     comment text,
     creator_id int NOT NULL,
-    create_date datetime NOT NULL ,
-    update_date datetime,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime,
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (best_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_mail_history (
-    send_id int auto_increment primary key  NOT NULL,
+    send_id int auto_increment NOT NULL,
     order_id int NOT NULL,
     send_date datetime,
@@ -521,9 +537,10 @@
     creator_id int NOT NULL,
     subject text,
-    mail_body text
-) TYPE=InnoDB ;
+    mail_body text,
+    PRIMARY KEY (send_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_customer (
-    customer_id int auto_increment primary key  NOT NULL,
+    customer_id int auto_increment NOT NULL,
     name01 text NOT NULL,
     name02 text NOT NULL,
@@ -557,6 +574,6 @@
     note text,
     status smallint NOT NULL DEFAULT 1,
-    create_date datetime NOT NULL ,
-    update_date datetime ,
+    create_date datetime NOT NULL,
+    update_date datetime,
     del_flg smallint NOT NULL DEFAULT 0,
     cell01 text,
@@ -564,6 +581,7 @@
     cell03 text,
     mobile_phone_id text,
-    mailmaga_flg smallint
-) TYPE=InnoDB ;
+    mailmaga_flg smallint,
+    PRIMARY KEY (customer_id)
+) TYPE=InnoDB;
 
 CREATE INDEX dtb_customer_mobile_phone_id_key ON dtb_customer (mobile_phone_id(64));
@@ -577,8 +595,8 @@
     create_data datetime NOT NULL,
     PRIMARY KEY (temp_id)
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_order (
-    order_id int auto_increment primary key NOT NULL,
+    order_id int auto_increment NOT NULL,
     order_temp_id text,
     customer_id int NOT NULL,
@@ -636,5 +654,5 @@
     note text,
     status smallint,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     loan_result text,
     credit_result text,
@@ -658,6 +676,7 @@
     memo09 text,
     memo10 text,
-    campaign_id int
-) TYPE=InnoDB ;
+    campaign_id int,
+    PRIMARY KEY (order_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_order_temp (
@@ -723,5 +742,5 @@
     credit_result text,
     credit_msg text,
-    create_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
     update_date datetime,
     del_flg smallint NOT NULL DEFAULT 0,
@@ -731,5 +750,5 @@
     cell02 text,
     cell03 text,
-    order_id int4,
+    order_id int,
     memo01 text,
     memo02 text,
@@ -743,8 +762,8 @@
     memo10 text,
     session text
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_other_deliv (
-    other_deliv_id int auto_increment primary key NOT NULL,
+    other_deliv_id int auto_increment NOT NULL,
     customer_id int NOT NULL,
     name01 text,
@@ -759,6 +778,7 @@
     tel01 text,
     tel02 text,
-    tel03 text
-) TYPE=InnoDB ;
+    tel03 text,
+    PRIMARY KEY (other_deliv_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_order_detail (
@@ -774,14 +794,15 @@
     quantity numeric,
     point_rate numeric
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE mtb_pref (
-    pref_id smallint primary key NOT NULL,
+    pref_id smallint NOT NULL,
     pref_name text,
-    rank smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    rank smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (pref_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_member (
-    member_id int auto_increment primary key NOT NULL,
+    member_id int auto_increment NOT NULL,
     name text,
     department text,
@@ -794,18 +815,20 @@
     creator_id int NOT NULL,
     update_date datetime,
-    create_date datetime NOT NULL ,
-    login_date datetime
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    login_date datetime,
+    PRIMARY KEY (member_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_question (
-    question_id int auto_increment primary key NOT NULL,
+    question_id int auto_increment NOT NULL,
     question_name text,
     question text,
-    create_date datetime NOT NULL ,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (question_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_question_result (
-    result_id int auto_increment primary key NOT NULL,
+    result_id int auto_increment NOT NULL,
     question_id int NOT NULL,
     question_date datetime,
@@ -830,7 +853,8 @@
     question05 text,
     question06 text,
-    create_date datetime NOT NULL ,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (result_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_bat_relate_products (
@@ -839,8 +863,8 @@
     customer_id int,
     create_date datetime
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_campaign (
-    campaign_id int auto_increment primary key NOT NULL,
+    campaign_id int auto_increment NOT NULL,
     campaign_name text,
     campaign_point_rate numeric NOT NULL,
@@ -849,14 +873,15 @@
     end_date datetime NOT NULL,
     directory_name text NOT NULL,
-    limit_count int4 NOT NULL DEFAULT 0,
-    total_count int4 NOT NULL DEFAULT 0,
-    orverlapping_flg int2 NOT NULL DEFAULT 0,
-    cart_flg int2 NOT NULL DEFAULT 0,
-    deliv_free_flg int2 NOT NULL DEFAULT 0,
+    limit_count int NOT NULL DEFAULT 0,
+    total_count int NOT NULL DEFAULT 0,
+    orverlapping_flg smallint NOT NULL DEFAULT 0,
+    cart_flg smallint NOT NULL DEFAULT 0,
+    deliv_free_flg smallint NOT NULL DEFAULT 0,
     search_condition text,
     del_flg smallint NOT NULL DEFAULT 0,
     create_date datetime NOT NULL,
-    update_date datetime NOT NULL
-) TYPE=InnoDB ;
+    update_date datetime NOT NULL,
+    PRIMARY KEY (campaign_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_campaign_detail (
@@ -864,8 +889,8 @@
     product_id int NOT NULL,
     campaign_point_rate numeric NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_pagelayout (
-    page_id int auto_increment primary key NOT NULL,
+    page_id int auto_increment NOT NULL,
     page_name text,
     url text NOT NULL,
@@ -880,18 +905,20 @@
     keyword text,
     update_url text,
-    create_date datetime NOT NULL ,
-    update_date datetime NOT NULL
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime NOT NULL,
+    PRIMARY KEY (page_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_bloc (
-    bloc_id int auto_increment primary key NOT NULL,
+    bloc_id int auto_increment NOT NULL,
     bloc_name text,
     tpl_path text,
     filename varchar(50) NOT NULL UNIQUE,
-    create_date datetime NOT NULL ,
-    update_date datetime NOT NULL ,
+    create_date datetime NOT NULL,
+    update_date datetime NOT NULL,
     php_path text,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (bloc_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_blocposition (
@@ -902,8 +929,8 @@
     filename text,
     anywhere int DEFAULT 0 NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_csv (
-    no int auto_increment primary key,
+    no int auto_increment,
     csv_id int NOT NULL,
     col text,
@@ -911,18 +938,20 @@
     rank int,
     status smallint NOT NULL DEFAULT 1,
-    create_date datetime NOT NULL ,
-    update_date datetime NOT NULL
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    update_date datetime NOT NULL,
+    PRIMARY KEY (no)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_csv_sql (
-    sql_id int auto_increment primary key,
+    sql_id int auto_increment,
     sql_name text NOT NULL,
     csv_sql text,
     update_date datetime NOT NULL,
-    create_date datetime NOT NULL
-) TYPE=InnoDB ;
+    create_date datetime NOT NULL,
+    PRIMARY KEY (sql_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_user_regist (
-    user_id int auto_increment primary key NOT NULL,
+    user_id int auto_increment NOT NULL,
     org_name text,
     post_name text,
@@ -938,25 +967,28 @@
     del_flg smallint DEFAULT 0,
     create_date datetime NOT NULL,
-    update_date datetime NOT NULL
-) TYPE=InnoDB ;
+    update_date datetime NOT NULL,
+    PRIMARY KEY (user_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_templates
 (
-    template_code        varchar(50) primary key NOT NULL,
-    template_name        text            ,
-    create_date        datetime        NOT NULL    ,
-    update_date        datetime        NOT NULL
-) TYPE=InnoDB ;
+    template_code varchar(50) NOT NULL,
+    template_name text,
+    create_date datetime NOT NULL,
+    update_date datetime NOT NULL,
+    PRIMARY KEY (template_code)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_table_comment
 (
-    id    int auto_increment primary key,
-    table_name    text,
-    column_name    text,
-    description    text
-) TYPE=InnoDB ;
+    id int auto_increment,
+    table_name text,
+    column_name text,
+    description text,
+    PRIMARY KEY (id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_maker (
-    maker_id INT auto_increment primary key,
+    maker_id int auto_increment,
     name text NOT NULL,
     rank int NOT NULL DEFAULT 0,
@@ -964,6 +996,7 @@
     create_date datetime NOT NULL,
     update_date datetime NOT NULL,
-    del_flg smallint NOT NULL DEFAULT 0
-) TYPE=InnoDB ;
+    del_flg smallint NOT NULL DEFAULT 0,
+    PRIMARY KEY (maker_id)
+) TYPE=InnoDB;
 
 CREATE TABLE dtb_maker_count (
@@ -971,5 +1004,5 @@
     product_count int NOT NULL,
     create_date datetime NOT NULL
-) TYPE=InnoDB ;
+) TYPE=InnoDB;
 
 
@@ -977,271 +1010,271 @@
     id text,
     name text,
-    rank int2 NOT NULL DEFAULT 0,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id(32))
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_disable_logout (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_authority (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_work (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_disp (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_class (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_srank (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_status (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_status_image (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_allowed_tag (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_page_max (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_magazine_type (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_mail_magazine_type (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_recommend (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_taxrule (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_mail_template (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_mail_tpl_path (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_job (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_reminder (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_sex (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_page_rows (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_mail_type (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_order_status (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_product_status_color (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_order_status_color (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_wday (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_delivery_date (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_product_list_max (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_convenience (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_conveni_message (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_db (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_target (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_review_deny_url (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_track_back_status (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_site_control_track_back (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_site_control_affiliate (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_mobile_domain (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_ownersstore_err (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
 
 CREATE TABLE mtb_ownersstore_ips (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 ) TYPE=InnoDB;
@@ -1250,5 +1283,6 @@
     id text,
     name text,
-    rank int2 NOT NULL DEFAULT 0,
-    remarks text
-) TYPE=InnoDB;
+    rank smallint NOT NULL DEFAULT 0,
+    remarks text,
+    PRIMARY KEY (id(64))
+) TYPE=InnoDB;
Index: /branches/comu-ver2/html/install/sql/create_table_pgsql.sql
===================================================================
--- /branches/comu-ver2/html/install/sql/create_table_pgsql.sql	(revision 18275)
+++ /branches/comu-ver2/html/install/sql/create_table_pgsql.sql	(revision 18331)
@@ -3,5 +3,5 @@
     module_id int NOT NULL,
     buckup_path text,
-    error_flg int2 default 0,
+    error_flg smallint DEFAULT 0,
     error text,
     ok text,
@@ -19,9 +19,9 @@
     kiyaku_title text NOT NULL,
     kiyaku_text text NOT NULL,
-    rank int4 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    rank int NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (kiyaku_id)
 );
@@ -30,11 +30,11 @@
     holiday_id serial NOT NULL,
     title text NOT NULL,
-    month int2 NOT NULL,
-    day int2 NOT NULL,
-    rank int4 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    month smallint NOT NULL,
+    day smallint NOT NULL,
+    rank int NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (holiday_id)
 );
@@ -62,7 +62,7 @@
     total numeric NOT NULL DEFAULT 0,
     total_average numeric NOT NULL DEFAULT 0,
-    start_age int2,
-    end_age int2,
-    member int2,
+    start_age smallint,
+    end_age smallint,
+    member smallint,
     order_date timestamp DEFAULT now(),
     create_date timestamp NOT NULL DEFAULT now()
@@ -70,5 +70,5 @@
 
 CREATE TABLE dtb_update (
-    module_id int4 NOT NULL,
+    module_id int NOT NULL,
     module_name text NOT NULL,
     now_version text,
@@ -80,5 +80,5 @@
     uninstall_sql text,
     other_files text,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp,
@@ -92,5 +92,5 @@
     zip01 text,
     zip02 text,
-    pref int2,
+    pref smallint,
     addr01 text,
     addr02 text,
@@ -106,5 +106,5 @@
     law_zip01 text,
     law_zip02 text,
-    law_pref int2,
+    law_pref smallint,
     law_addr01 text,
     law_addr02 text,
@@ -128,5 +128,5 @@
     law_term10 text,
     tax numeric NOT NULL DEFAULT 5,
-    tax_rule int2 NOT NULL DEFAULT 1,
+    tax_rule smallint NOT NULL DEFAULT 1,
     email01 text,
     email02 text,
@@ -154,8 +154,8 @@
     service_name text,
     confirm_url text,
-    rank int4,
-    status int2 NOT NULL DEFAULT 1,
-    del_flg int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    rank int,
+    status smallint NOT NULL DEFAULT 1,
+    del_flg smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp,
@@ -164,6 +164,6 @@
 
 CREATE TABLE dtb_delivtime (
-    deliv_id int4 NOT NULL,
-    time_id int4 NOT NULL,
+    deliv_id int NOT NULL,
+    time_id int NOT NULL,
     deliv_time text NOT NULL,
     PRIMARY KEY (deliv_id, time_id)
@@ -171,8 +171,8 @@
 
 CREATE TABLE dtb_delivfee (
-    deliv_id int4 NOT NULL,
+    deliv_id int NOT NULL,
     fee_id serial NOT NULL,
     fee text NOT NULL,
-    pref int2,
+    pref smallint,
     PRIMARY KEY (fee_id)
 );
@@ -183,19 +183,19 @@
     charge numeric,
     rule numeric,
-    deliv_id int4 DEFAULT 0,
-    rank int4,
+    deliv_id int DEFAULT 0,
+    rank int,
     note text,
-    fix int2,
-    status int2 NOT NULL DEFAULT 1,
-    del_flg int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    fix smallint,
+    status smallint NOT NULL DEFAULT 1,
+    del_flg smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp,
     payment_image text,
     upper_rule numeric,
-    charge_flg int2 DEFAULT 1,
+    charge_flg smallint DEFAULT 1,
     rule_min numeric,
     upper_rule_max numeric,
-    module_id int4,
+    module_id int,
     module_path text,
     memo01 text,
@@ -213,10 +213,10 @@
 
 CREATE TABLE dtb_mailtemplate (
-    template_id int4 NOT NULL,
+    template_id int NOT NULL,
     subject text,
     header text,
     footer text,
-    creator_id int4 NOT NULL,
-    del_flg int2 NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
+    del_flg smallint NOT NULL DEFAULT 0,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL
@@ -227,26 +227,26 @@
     subject text,
     charge_image text,
-    mail_method int4,
+    mail_method int,
     header text,
     body text,
     main_title text,
     main_comment text,
-    main_product_id int4,
+    main_product_id int,
     sub_title text,
     sub_comment text,
-    sub_product_id01 int4,
-    sub_product_id02 int4,
-    sub_product_id03 int4,
-    sub_product_id04 int4,
-    sub_product_id05 int4,
-    sub_product_id06 int4,
-    sub_product_id07 int4,
-    sub_product_id08 int4,
-    sub_product_id09 int4,
-    sub_product_id10 int4,
-    sub_product_id11 int4,
-    sub_product_id12 int4,
-    del_flg int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    sub_product_id01 int,
+    sub_product_id02 int,
+    sub_product_id03 int,
+    sub_product_id04 int,
+    sub_product_id05 int,
+    sub_product_id06 int,
+    sub_product_id07 int,
+    sub_product_id08 int,
+    sub_product_id09 int,
+    sub_product_id10 int,
+    sub_product_id11 int,
+    sub_product_id12 int,
+    del_flg smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp,
@@ -256,14 +256,14 @@
 CREATE TABLE dtb_send_history (
     send_id serial NOT NULL,
-    mail_method int2,
+    mail_method smallint,
     subject text,
     body text,
-    send_count int4,
-    complete_count int4 NOT NULL DEFAULT 0,
+    send_count int,
+    complete_count int NOT NULL DEFAULT 0,
     start_date timestamp,
     end_date timestamp,
     search_data text,
-    del_flg int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    del_flg smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL DEFAULT now(),
@@ -272,9 +272,9 @@
 
 CREATE TABLE dtb_send_customer (
-    customer_id int4,
+    customer_id int,
     send_id serial NOT NULL,
     email text,
     name text,
-    send_flag int2
+    send_flag smallint
 );
 
@@ -284,8 +284,8 @@
     deliv_fee numeric,
     sale_limit numeric,
-    category_id int4,
-    maker_id int4,
-    rank int4,
-    status int2 NOT NULL DEFAULT 2,
+    category_id int,
+    maker_id int,
+    rank int,
+    status smallint NOT NULL DEFAULT 2,
     product_flag text,
     point_rate numeric,
@@ -332,9 +332,9 @@
     sub_image6 text,
     sub_large_image6 text,
-    del_flg int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    deliv_date_id int4,
+    del_flg smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    deliv_date_id int,
     PRIMARY KEY (product_id)
 );
@@ -342,15 +342,15 @@
 CREATE TABLE dtb_products_class (
     product_class_id serial NOT NULL,
-    product_id int4 NOT NULL,
-    classcategory_id1 int4 NOT NULL DEFAULT 0,
-    classcategory_id2 int4 NOT NULL DEFAULT 0,
+    product_id int NOT NULL,
+    classcategory_id1 int NOT NULL DEFAULT 0,
+    classcategory_id2 int NOT NULL DEFAULT 0,
     product_code text,
     stock numeric,
-    stock_unlimited int2 NOT NULL DEFAULT 0,
+    stock_unlimited smallint NOT NULL DEFAULT 0,
     sale_limit numeric,
     price01 numeric,
     price02 numeric,
-    status int2,
-    creator_id int4 NOT NULL,
+    status smallint,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp,
@@ -361,11 +361,11 @@
     class_id serial NOT NULL,
     name text,
-    status int2,
-    rank int4,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
-    product_id int4,
+    status smallint,
+    rank int,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    del_flg smallint NOT NULL DEFAULT 0,
+    product_id int,
     PRIMARY KEY (class_id)
 );
@@ -374,11 +374,11 @@
     classcategory_id serial NOT NULL,
     name text,
-    class_id int4 NOT NULL,
-    status int2,
-    rank int4,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    class_id int NOT NULL,
+    status smallint,
+    rank int,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (classcategory_id)
 );
@@ -387,18 +387,18 @@
     category_id serial NOT NULL,
     category_name text,
-    parent_category_id int4 NOT NULL DEFAULT 0,
-    level int4 NOT NULL,
-    rank int4,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    parent_category_id int NOT NULL DEFAULT 0,
+    level int NOT NULL,
+    rank int,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (category_id)
 );
 
 CREATE TABLE dtb_product_categories (
-    product_id int4 NOT NULL,
-    category_id int4 NOT NULL,
-    rank int4 NOT NULL,
+    product_id int NOT NULL,
+    category_id int NOT NULL,
+    rank int NOT NULL,
     PRIMARY KEY(product_id, category_id)
 );
@@ -418,8 +418,8 @@
     order_date timestamp NOT NULL DEFAULT now(),
     create_date timestamp NOT NULL DEFAULT now(),
-    year int2 NOT NULL,
-    month int2 NOT NULL,
-    day int2 NOT NULL,
-    wday int2 NOT NULL,
+    year smallint NOT NULL,
+    month smallint NOT NULL,
+    day smallint NOT NULL,
+    wday smallint NOT NULL,
     key_day text NOT NULL,
     key_month text NOT NULL,
@@ -440,5 +440,5 @@
     total numeric NOT NULL DEFAULT 0,
     total_average numeric NOT NULL DEFAULT 0,
-    hour int2 NOT NULL DEFAULT 0,
+    hour smallint NOT NULL DEFAULT 0,
     order_date timestamp DEFAULT now(),
     create_date timestamp NOT NULL DEFAULT now()
@@ -446,10 +446,10 @@
 
 CREATE TABLE dtb_recommend_products (
-    product_id int4 NOT NULL,
-    recommend_product_id int4 NOT NULL,
-    rank int4 NOT NULL,
+    product_id int NOT NULL,
+    recommend_product_id int NOT NULL,
+    rank int NOT NULL,
     comment text,
-    status int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    status smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL DEFAULT now()
@@ -458,23 +458,23 @@
 CREATE TABLE dtb_review (
     review_id serial NOT NULL,
-    product_id int4 NOT NULL,
+    product_id int NOT NULL,
     reviewer_name text NOT NULL,
     reviewer_url text,
-    sex int2,
-    customer_id int4,
-    recommend_level int2 NOT NULL,
+    sex smallint,
+    customer_id int,
+    recommend_level smallint NOT NULL,
     title text NOT NULL,
     comment text NOT NULL,
-    status int2 DEFAULT 2,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    status smallint DEFAULT 2,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (review_id)
 );
 
 CREATE TABLE dtb_customer_reading (
-    reading_product_id int4 NOT NULL,
-    customer_id int4 NOT NULL,
+    reading_product_id int NOT NULL,
+    customer_id int NOT NULL,
     create_date timestamp NOT NULL,
     update_date timestamp NOT NULL DEFAULT NOW()
@@ -482,6 +482,6 @@
 
 CREATE TABLE dtb_customer_favorite_products (
-    customer_id int4 NOT NULL,
-    product_id int4 NOT NULL,
+    customer_id int NOT NULL,
+    product_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL DEFAULT now(),
@@ -490,12 +490,12 @@
 
 CREATE TABLE dtb_category_count (
-    category_id int4 NOT NULL,
-    product_count int4 NOT NULL,
+    category_id int NOT NULL,
+    product_count int NOT NULL,
     create_date timestamp NOT NULL DEFAULT Now()
 );
 
 CREATE TABLE dtb_category_total_count (
-    category_id int4 NOT NULL,
-    product_count int4,
+    category_id int NOT NULL,
+    product_count int,
     create_date timestamp NOT NULL DEFAULT Now()
 );
@@ -504,14 +504,14 @@
     news_id serial NOT NULL,
     news_date timestamp,
-    rank int4,
+    rank int,
     news_title text NOT NULL,
     news_comment text,
     news_url text,
-    news_select int2 NOT NULL DEFAULT 0,
+    news_select smallint NOT NULL DEFAULT 0,
     link_method text,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (news_id)
 );
@@ -519,22 +519,22 @@
 CREATE TABLE dtb_best_products (
     best_id serial NOT NULL,
-    category_id int4 NOT NULL,
-    rank int4 NOT NULL DEFAULT 0,
-    product_id int4 NOT NULL,
+    category_id int NOT NULL,
+    rank int NOT NULL DEFAULT 0,
+    product_id int NOT NULL,
     title text,
     comment text,
-    creator_id int4 NOT NULL,
-    create_date timestamp NOT NULL DEFAULT now(),
-    update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (best_id)
 );
 
 CREATE TABLE dtb_mail_history (
-    send_id serial  NOT NULL,
-    order_id int4 NOT NULL,
+    send_id serial NOT NULL,
+    order_id int NOT NULL,
     send_date timestamp,
-    template_id int4,
-    creator_id int4 NOT NULL,
+    template_id int,
+    creator_id int NOT NULL,
     subject text,
     mail_body text,
@@ -543,5 +543,5 @@
 
 CREATE TABLE dtb_customer (
-    customer_id serial  NOT NULL,
+    customer_id serial NOT NULL,
     name01 text NOT NULL,
     name02 text NOT NULL,
@@ -550,5 +550,5 @@
     zip01 text,
     zip02 text,
-    pref int2,
+    pref smallint,
     addr01 text,
     addr02 text,
@@ -561,9 +561,9 @@
     fax02 text,
     fax03 text,
-    sex int2,
-    job int2,
+    sex smallint,
+    job smallint,
     birth timestamp,
     password text,
-    reminder int2,
+    reminder smallint,
     reminder_answer text,
     secret_key text NOT NULL UNIQUE,
@@ -574,13 +574,13 @@
     point numeric DEFAULT 0,
     note text,
-    status int2 NOT NULL DEFAULT 1,
+    status smallint NOT NULL DEFAULT 1,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp DEFAULT now(),
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     cell01 text,
     cell02 text,
     cell03 text,
     mobile_phone_id text,
-    mailmaga_flg int2,
+    mailmaga_flg smallint,
     PRIMARY KEY (customer_id)
 );
@@ -590,7 +590,7 @@
 CREATE TABLE dtb_customer_mail_temp (
     email text NOT NULL UNIQUE,
-    mail_flag int2,
+    mail_flag smallint,
     temp_id text NOT NULL,
-    end_flag int2,
+    end_flag smallint,
     update_date timestamp NOT NULL DEFAULT Now(),
     create_data timestamp NOT NULL DEFAULT Now(),
@@ -601,5 +601,5 @@
     order_id serial NOT NULL,
     order_temp_id text,
-    customer_id int4 NOT NULL,
+    customer_id int NOT NULL,
     message text,
     order_name01 text,
@@ -619,7 +619,7 @@
     order_addr01 text,
     order_addr02 text,
-    order_sex int2,
+    order_sex smallint,
     order_birth timestamp,
-    order_job int4,
+    order_job int,
     deliv_name01 text,
     deliv_name02 text,
@@ -647,12 +647,12 @@
     total numeric,
     payment_total numeric,
-    payment_id int4,
+    payment_id int,
     payment_method text,
-    deliv_id int4,
-    deliv_time_id int4,
+    deliv_id int,
+    deliv_time_id int,
     deliv_time text,
     deliv_no text,
     note text,
-    status int2,
+    status smallint,
     create_date timestamp NOT NULL DEFAULT now(),
     loan_result text,
@@ -661,5 +661,5 @@
     update_date timestamp,
     commit_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     deliv_date text,
     conveni_data text,
@@ -677,5 +677,5 @@
     memo09 text,
     memo10 text,
-    campaign_id int4,
+    campaign_id int,
     PRIMARY KEY (order_id)
 );
@@ -683,5 +683,5 @@
 CREATE TABLE dtb_order_temp (
     order_temp_id text NOT NULL,
-    customer_id int4 NOT NULL,
+    customer_id int NOT NULL,
     message text,
     order_name01 text,
@@ -701,7 +701,7 @@
     order_addr01 text,
     order_addr02 text,
-    order_sex int2,
+    order_sex smallint,
     order_birth timestamp,
-    order_job int4,
+    order_job int,
     deliv_name01 text,
     deliv_name02 text,
@@ -729,15 +729,15 @@
     total numeric,
     payment_total numeric,
-    payment_id int4,
+    payment_id int,
     payment_method text,
-    deliv_id int4,
-    deliv_time_id int4,
+    deliv_id int,
+    deliv_time_id int,
     deliv_time text,
     deliv_no text,
     note text,
-    mail_flag int2,
-    status int2,
-    deliv_check int2,
-    point_check int2,
+    mail_flag smallint,
+    status smallint,
+    deliv_check smallint,
+    point_check smallint,
     loan_result text,
     credit_result text,
@@ -745,5 +745,5 @@
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     deliv_date text,
     conveni_data text,
@@ -751,5 +751,5 @@
     cell02 text,
     cell03 text,
-    order_id int4,
+    order_id int,
     memo01 text,
     memo02 text,
@@ -767,5 +767,5 @@
 CREATE TABLE dtb_other_deliv (
     other_deliv_id serial NOT NULL,
-    customer_id int4 NOT NULL,
+    customer_id int NOT NULL,
     name01 text,
     name02 text,
@@ -784,8 +784,8 @@
 
 CREATE TABLE dtb_order_detail (
-    order_id int4 NOT NULL,
-    product_id int4 NOT NULL,
-    classcategory_id1 int4 NOT NULL,
-    classcategory_id2 int4 NOT NULL,
+    order_id int NOT NULL,
+    product_id int NOT NULL,
+    classcategory_id1 int NOT NULL,
+    classcategory_id2 int NOT NULL,
     product_name text NOT NULL,
     product_code text,
@@ -798,7 +798,7 @@
 
 CREATE TABLE mtb_pref (
-    pref_id int2 NOT NULL,
+    pref_id smallint NOT NULL,
     pref_name text,
-    rank int2 NOT NULL DEFAULT 0,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (pref_id)
 );
@@ -810,9 +810,9 @@
     login_id text NOT NULL,
     password text NOT NULL,
-    authority int2 NOT NULL,
-    rank int4 NOT NULL DEFAULT 0,
-    work int2 NOT NULL DEFAULT 1,
-    del_flg int2 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    authority smallint NOT NULL,
+    rank int NOT NULL DEFAULT 0,
+    work smallint NOT NULL DEFAULT 1,
+    del_flg smallint NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     update_date timestamp,
     create_date timestamp NOT NULL DEFAULT now(),
@@ -826,5 +826,5 @@
     question text,
     create_date timestamp NOT NULL DEFAULT now(),
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (question_id)
 );
@@ -832,5 +832,5 @@
 CREATE TABLE dtb_question_result (
     result_id serial NOT NULL,
-    question_id int4 NOT NULL,
+    question_id int NOT NULL,
     question_date timestamp,
     question_name text,
@@ -841,5 +841,5 @@
     zip01 text,
     zip02 text,
-    pref int2,
+    pref smallint,
     addr01 text,
     addr02 text,
@@ -855,12 +855,12 @@
     question06 text,
     create_date timestamp NOT NULL DEFAULT now(),
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (result_id)
 );
 
 CREATE TABLE dtb_bat_relate_products (
-    product_id int4,
-    relate_product_id int4,
-    customer_id int4,
+    product_id int,
+    relate_product_id int,
+    customer_id int,
     create_date timestamp DEFAULT now()
 );
@@ -870,15 +870,15 @@
     campaign_name text,
     campaign_point_rate numeric NOT NULL,
-    campaign_point_type int2,
+    campaign_point_type smallint,
     start_date timestamp NOT NULL,
     end_date timestamp NOT NULL,
     directory_name text NOT NULL,
-    limit_count int4 NOT NULL DEFAULT 0,
-    total_count int4 NOT NULL DEFAULT 0,
-    orverlapping_flg int2 NOT NULL DEFAULT 0,
-    cart_flg int2 NOT NULL DEFAULT 0,
-    deliv_free_flg int2 NOT NULL DEFAULT 0,
+    limit_count int NOT NULL DEFAULT 0,
+    total_count int NOT NULL DEFAULT 0,
+    orverlapping_flg smallint NOT NULL DEFAULT 0,
+    cart_flg smallint NOT NULL DEFAULT 0,
+    deliv_free_flg smallint NOT NULL DEFAULT 0,
     search_condition text,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     create_date timestamp NOT NULL,
     update_date timestamp NOT NULL DEFAULT now(),
@@ -887,6 +887,6 @@
 
 CREATE TABLE dtb_campaign_detail (
-    campaign_id int4 NOT NULL,
-    product_id int4 NOT NULL,
+    campaign_id int NOT NULL,
+    product_id int NOT NULL,
     campaign_point_rate numeric NOT NULL
 );
@@ -899,7 +899,7 @@
     tpl_dir text,
     filename text,
-    header_chk int2 DEFAULT 1,
-    footer_chk int2 DEFAULT 1,
-    edit_flg int2 DEFAULT 1,
+    header_chk smallint DEFAULT 1,
+    footer_chk smallint DEFAULT 1,
+    edit_flg smallint DEFAULT 1,
     author text,
     description text,
@@ -919,24 +919,24 @@
     update_date timestamp NOT NULL DEFAULT now(),
     php_path text,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (bloc_id)
 );
 
 CREATE TABLE dtb_blocposition (
-    page_id int4 NOT NULL,
-    target_id int4,
-    bloc_id int4,
-    bloc_row int4,
+    page_id int NOT NULL,
+    target_id int,
+    bloc_id int,
+    bloc_row int,
     filename text,
-    anywhere int2 DEFAULT 0 NOT NULL
+    anywhere smallint DEFAULT 0 NOT NULL
 );
 
 CREATE TABLE dtb_csv (
     no serial,
-    csv_id int4 NOT NULL,
+    csv_id int NOT NULL,
     col text,
     disp_name text,
-    rank int4,
-    status int2 NOT NULL DEFAULT 1,
+    rank int,
+    status smallint NOT NULL DEFAULT 1,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL DEFAULT now(),
@@ -965,6 +965,6 @@
     note text,
     secret_key text NOT NULL UNIQUE,
-    status int2 NOT NULL,
-    del_flg int2 DEFAULT 0,
+    status smallint NOT NULL,
+    del_flg smallint DEFAULT 0,
     create_date timestamp NOT NULL,
     update_date timestamp NOT NULL DEFAULT now(),
@@ -973,16 +973,16 @@
 
 create table dtb_templates (
-    template_code        text        NOT NULL,
-    template_name        text            ,
-    create_date        timestamp        NOT NULL    default now(),
-    update_date        timestamp        NOT NULL    default now(),
+    template_code text NOT NULL,
+    template_name text,
+    create_date timestamp NOT NULL DEFAULT now(),
+    update_date timestamp NOT NULL DEFAULT now(),
     PRIMARY KEY (template_code)
 );
 
 create table dtb_table_comment (
-    id    serial,
-    table_name    text,
-    column_name    text,
-    description    text,
+    id serial,
+    table_name text,
+    column_name text,
+    description text,
     PRIMARY KEY (id)
 );
@@ -991,15 +991,15 @@
     maker_id serial NOT NULL,
     name text NOT NULL,
-    rank int4 NOT NULL DEFAULT 0,
-    creator_id int4 NOT NULL,
+    rank int NOT NULL DEFAULT 0,
+    creator_id int NOT NULL,
     create_date timestamp NOT NULL DEFAULT now(),
     update_date timestamp NOT NULL,
-    del_flg int2 NOT NULL DEFAULT 0,
+    del_flg smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (maker_id)
 );
 
 CREATE TABLE dtb_maker_count (
-    maker_id int4 NOT NULL,
-    product_count int4 NOT NULL,
+    maker_id int NOT NULL,
+    product_count int NOT NULL,
     create_date timestamp NOT NULL DEFAULT Now()
 );
@@ -1008,257 +1008,257 @@
     id text,
     name text,
-    rank int2 NOT NULL DEFAULT 0,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_disable_logout (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_authority (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_work (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_disp (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_class (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_srank (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_status (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_status_image (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_allowed_tag (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_page_max (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_magazine_type (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_mail_magazine_type (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_recommend (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_taxrule (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_mail_template (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_mail_tpl_path (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_job (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_reminder (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_sex (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_page_rows (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_mail_type (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_order_status (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_product_status_color (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_order_status_color (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_wday (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_delivery_date (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_product_list_max (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_convenience (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_conveni_message (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_db (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_target (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_review_deny_url (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_track_back_status (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_site_control_track_back (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_site_control_affiliate (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
 
 CREATE TABLE mtb_mobile_domain (
-    id int2,
-    name text,
-    rank int2 NOT NULL DEFAULT 0,
+    id smallint,
+    name text,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
@@ -1267,5 +1267,5 @@
     id text,
     name text,
-    rank int2 NOT NULL DEFAULT 0,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
@@ -1274,5 +1274,5 @@
     id text,
     name text,
-    rank int2 NOT NULL DEFAULT 0,
+    rank smallint NOT NULL DEFAULT 0,
     PRIMARY KEY (id)
 );
@@ -1281,5 +1281,5 @@
     id text,
     name text,
-    rank int2 NOT NULL DEFAULT 0,
+    rank smallint NOT NULL DEFAULT 0,
     remarks text,
     PRIMARY KEY (id)
