# $Id: update_tables-0.8.3.mysql,v 1.16.2.1 2001/06/16 05:47:49 bettina Exp $

# ------------------------------------------------------------
# --             02/07/2001  0.8.3pre1                      --
# ------------------------------------------------------------

drop table phpgw_inv_categorys;
alter table phpgw_inv_products modify column id varchar(11);

# ------------------------------------------------------------
# --             02/16/2001  0.8.3pre2                      --
# ------------------------------------------------------------

alter table phpgw_inv_orders add column owner int(11) DEFAULT '0' NOT NULL after id;

alter table phpgw_inv_products modify column category int(9) DEFAULT '0' NOT NULL;

alter table phpgw_inv_orderpos modify column order_id int(11) DEFAULT '0' NOT NULL;
alter table phpgw_inv_orderpos modify column product_id int(11) DEFAULT '0' NOT NULL;

alter table phpgw_inv_deliverypos modify column delivery_id int(11) DEFAULT '0' NOT NULL;
alter table phpgw_inv_deliverypos modify column product_id int(11) DEFAULT '0' NOT NULL;

alter table phpgw_inv_invoicepos modify column invoice_id int(11) DEFAULT '0' NOT NULL;
alter table phpgw_inv_invoicepos modify column product_id int(11) DEFAULT '0' NOT NULL;

alter table phpgw_inv_invoice modify column order_id int(11) DEFAULT '0' NOT NULL;

alter table phpgw_inv_delivery modify column order_id int(11) DEFAULT '0' NOT NULL;

# ------------------------------------------------------------
# --             02/21/2001 0.8.3pre3                       --
# ------------------------------------------------------------

drop table phpgw_inv_dist;

alter table phpgw_inv_products add column date int(11) DEFAULT '0' NOT NULL;

alter table phpgw_inv_products drop column des;
alter table phpgw_inv_products add column descr varchar(255) NOT NULL after name;

alter table phpgw_inv_products add column serial varchar(64) NOT NULL after id;
alter table phpgw_inv_products modify column id varchar(20) NOT NULL;

CREATE INDEX phpgw_inv_products_key ON phpgw_inv_products(con,id);

CREATE INDEX phpgw_inv_orders_key ON phpgw_inv_orders(id,num);

CREATE INDEX phpgw_inv_delivery_key ON phpgw_inv_delivery(id,num);

CREATE INDEX phpgw_inv_invoice_key ON phpgw_inv_invoice(id,num);

###############################################################
#                   03/04/2001 0.8.3pre4                      #
###############################################################

alter table phpgw_inv_products add column ftp varchar(255) NOT NULL after url;
alter table phpgw_inv_products drop column date;
alter table phpgw_inv_products add column pdate int(11) DEFAULT '0' NOT NULL;
alter table phpgw_inv_products add column sdate int(11) DEFAULT '0' NOT NULL;
insert into phpgw_inv_statuslist (status_name) values ('saled');

###############################################################
#                   03/04/2001 0.8.3pre5                      #
############################################################### 

insert into phpgw_inv_statuslist (status_name) values ('archive');
alter table phpgw_inv_orders add column status enum('open','closed','archive') NOT NULL;

###############################################################
#                   03/04/2001 0.8.3pre6                      #
###############################################################

alter table phpgw_inv_orders add column access char(7) after owner;

###############################################################
#                   03/04/2001 0.8.3.009                      #
###############################################################

alter table phpgw_inv_orderpos add column dstatus char(4) DEFAULT 'open' NOT NULL;
alter table phpgw_inv_orderpos add column istatus char(4) DEFAULT 'open' NOT NULL;
