# $Id: update_tables-0.8.3.mysql,v 1.20 2001/06/10 03:19:15 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 varchar(7) after owner;

###############################################################
#                   03/04/2001 0.8.3.007                      #
###############################################################

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

	CREATE TABLE phpgw_inv_stockrooms (
		id			int(11) unsigned PRIMARY KEY NOT NULL auto_increment,
		room_owner	int(11) DEFAULT '0' NOT NULL,
		room_access	varchar(7),
		room_name	varchar(255) NOT NULL,
		room_note	text
	);

	alter table phpgw_inv_products add column product_note text;
	delete from phpgw_inv_statuslist where status_name='saled';
	insert into phpgw_inv_statuslist (status_name) values ('sold');

###############################################################
#                   03/04/2001 0.8.3.008                      #
###############################################################

	CREATE UNIQUE INDEX order_num ON phpgw_inv_orders(num);
	CREATE UNIQUE INDEX invoice_num ON phpgw_inv_invoice(num);
	CREATE UNIQUE INDEX delivery_num ON phpgw_inv_delivery(num);
