-- Licensed Materials - Property of IBM
-- BI and PM: Mobile
-- (C) Copyright IBM Corp. 2007, 2012
-- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

DECLARE
	TABLE_DOES_NOT_EXIST_EXCEPTION EXCEPTION;
	PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST_EXCEPTION, -942);
BEGIN
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_BLOBS DROP COLUMN FORMAT';
EXCEPTION
	WHEN TABLE_DOES_NOT_EXIST_EXCEPTION THEN
		NULL;
END;
/
DECLARE
	TABLE_DOES_NOT_EXIST_EXCEPTION EXCEPTION;
	PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST_EXCEPTION, -942);
BEGIN
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_RESOURCES ADD FORMAT smallint NULL';
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_RESOURCES ADD HEIGHT int NULL';
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_RESOURCES ADD WIDTH int NULL';
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_RESOURCES ADD BLOB_ID int NULL';
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_RESOURCES ADD OBJECT_INDEX int NULL';
	EXECUTE IMMEDIATE 'ALTER TABLE MOB_RESOURCES ADD PAGE_INDEX int NULL';
EXCEPTION
	WHEN TABLE_DOES_NOT_EXIST_EXCEPTION THEN
		NULL;
END;
/

DECLARE
	TABLE_DOES_NOT_EXIST_EXCEPTION EXCEPTION;
	PRAGMA EXCEPTION_INIT(TABLE_DOES_NOT_EXIST_EXCEPTION, -942);
BEGIN
	EXECUTE IMMEDIATE 'DROP TABLE MOB_BLOB_FORMATS';
EXCEPTION
	WHEN TABLE_DOES_NOT_EXIST_EXCEPTION THEN
		NULL;
END;
/
DECLARE
	TABLE_EXISTS_EXCEPTION EXCEPTION;
	PRAGMA EXCEPTION_INIT (TABLE_EXISTS_EXCEPTION, -955);
BEGIN
	EXECUTE IMMEDIATE 'CREATE TABLE MOB_RESOURCE_FORMATS (
		FORMAT smallint NOT NULL,
		DESCRIPTION varchar (100) NULL 
	)';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (0, ''USER COOKIE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (1, ''REPORT INFO'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (2, ''REPORT OUTPUT'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (3, ''DB'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (4, ''PAGE HTML'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (5, ''IMAGE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (6, ''RENDER THUMBNAIL SMALL'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (7, ''RENDER THUMBNAIL LARGE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (8, ''iOS THUMBNAIL SMALL'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (9, ''iOS THUMBNAIL LARGE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (10, ''SVG'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (11, ''TABLE HTML'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (12, ''ATTCH IMAGE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (13, ''CONVERSATION STATE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (14, ''DASHBOARD'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (15, ''BUX CONVERSATION STATE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (16, ''GENERAL RESOURCE'')';
	EXECUTE IMMEDIATE 'INSERT INTO MOB_RESOURCE_FORMATS VALUES (17, ''PAGE HTMLI'')';
EXCEPTION
	WHEN TABLE_EXISTS_EXCEPTION THEN
		NULL;
END;
/
