IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE 
	TABLE_NAME = 'publ_PurchaseOrderStockPickQuoteItemFinal'
	AND COLUMN_NAME = 'totallyPicked')
BEGIN
	ALTER TABLE [publ_PurchaseOrderStockPickQuoteItemFinal] ADD [totallyPicked] INT NULL;
	UPDATE publ_PurchaseOrderStockPickQuoteItemFinal SET totallyPicked = 0;
END


IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE 
	TABLE_NAME = 'publ_PurchaseOrders'
	AND COLUMN_NAME = 'notes')
BEGIN
	ALTER TABLE [publ_PurchaseOrders] ADD [notes] [text] NULL;
END

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE 
	TABLE_NAME = 'publ_PurchaseOrders'
	AND COLUMN_NAME = 'dateChanged')
BEGIN
	ALTER TABLE dbo.publ_PurchaseOrders ADD dateChanged datetime NULL;
END

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE 
	TABLE_NAME = 'publ_PurchaseOrders'
	AND COLUMN_NAME = 'rowVersion')
BEGIN
	ALTER TABLE dbo.publ_PurchaseOrders ADD rowVersion timestamp NULL;
END

IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.COLUMNS WHERE 
	TABLE_NAME = 'publ_PurchaseOrders'
	AND COLUMN_NAME = 'cancelReason')
BEGIN
	ALTER TABLE [publ_PurchaseOrders] ADD [cancelReason] [text] NULL;
END
