Location: PHPKode > projects > EXtensible Production Suite (XPS) > xpsdev/install/configs/sql_statements.xml
<?xml version="1.0" encoding="UTF-8"?>
<sql_statements xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="..\..\xml_schemas\sql_statements.xsd">
<!--CREATE DATABASE-->
    <sql_statement id="create_database">
        <sql db_lang="default">
            CREATE DATABASE {tablespace}
        </sql>
        <sql db_lang="oracle">
            CREATE TABLESPACE {tablespace} DATAFILE '{oracle_path}' SIZE {oracle_size}M AUTOEXTEND {oracle_autoextend}
        </sql>
    </sql_statement>
<!--DETECT DATABASE-->
	<sql_statement id="detect_database">
        <sql db_lang="default">
            SELECT TABLESPACE_NAME FROM dba_data_files WHERE TABLESPACE_NAME=:TABLESPACE_NAME
        </sql>
    </sql_statement>
<!--DROP DATABASE-->
	<sql_statement id="drop_database">
        <sql db_lang="mysql">
            DROP DATABASE {tablespace}
        </sql>
		<sql db_lang="oracle">
            DROP TABLESPACE {tablespace} INCLUDING CONTENTS
        </sql>
    </sql_statement>
    <sql_statement id="oracle_file_path">
        <sql db_lang="default">
			SELECT FILE_NAME FROM dba_data_files WHERE TABLESPACE_NAME=:TABLESPACE_NAME
        </sql>
    </sql_statement>

<!--XPS CONNECTION USER-->
    <sql_statement id="create_connection_user">
        <sql db_lang="default">
            CREATE USER '{user}'@'%' IDENTIFIED BY '{password}'
        </sql>
        <sql db_lang="oracle">
            CREATE USER "{user}" IDENTIFIED BY "{password}" 
			DEFAULT TABLESPACE {tablespace}
			TEMPORARY TABLESPACE TEMP
			QUOTA UNLIMITED ON {user}
        </sql>
    </sql_statement>
    <sql_statement id="grant_connection_user_permissions">
        <sql db_lang="default">
            GRANT ALL ON {tablespace}.* TO '{user}'@'%'
        </sql>
		<sql db_lang="oracle">
            GRANT RESOURCE, CONNECT TO {user}
        </sql>
    </sql_statement>
    <sql_statement id="drop_connection_user">
        <sql db_lang="default">
            DROP USER '{user}'@'%'
        </sql>
		<sql db_lang="oracle">
            DROP USER {user} CASCADE
        </sql>
    </sql_statement>
    

<!--CREATE TABLES-->
    <sql_statement id="create_xps_user">
        <sql db_lang="default">
            CREATE TABLE {table_prefix}XPS_USER
            (
                USER_ID					VARCHAR(20) PRIMARY KEY,
                FIRST_NAME				VARCHAR(40) NOT NULL,
                MIDDLE_NAME				VARCHAR(40),
                LAST_NAME				VARCHAR(40) NOT NULL,
                NAME_PREFIX				VARCHAR(40),
                DESCRIPTION				VARCHAR(500),
                PASSWORD_TEXT			VARCHAR(40) NOT NULL,
                PASSWORD_SALT			VARCHAR(32),
                PASSWORD_CREATE_DATE	DATE,
                JOIN_DATE   			DATE,
                IS_ADMIN				TINYINT,
                ACCOUNT_ACTIVE			TINYINT,
                THEME                   VARCHAR(40),
                EMAIL                   VARCHAR(60),
                CONFIRM_GUID            VARCHAR(32)
            ) TYPE INNODB
        </sql>
        <sql db_lang="oracle">
            CREATE TABLE {table_prefix}XPS_USER
            (
                USER_ID					VARCHAR2(20) PRIMARY KEY,
                FIRST_NAME				VARCHAR2(40) NOT NULL,
                MIDDLE_NAME				VARCHAR2(40),
                LAST_NAME				VARCHAR2(40) NOT NULL,
                NAME_PREFIX				VARCHAR2(40),
                DESCRIPTION				VARCHAR2(500),
                PASSWORD_TEXT			VARCHAR2(40) NOT NULL,
                PASSWORD_SALT			VARCHAR2(32),
                PASSWORD_CREATE_DATE	DATE,
                JOIN_DATE   			DATE,
                IS_ADMIN				NUMBER(5),
                ACCOUNT_ACTIVE			NUMBER(5),
                THEME                   VARCHAR2(40),
                EMAIL                   VARCHAR2(60),
                CONFIRM_GUID            VARCHAR2(32)
            )
        </sql>
    </sql_statement>
    <sql_statement id="create_xps_module">
        <sql db_lang="default">
            CREATE TABLE {table_prefix}XPS_MODULE
            (
                MODULE_ID				VARCHAR(32) PRIMARY KEY,
                MODULE_NAME				VARCHAR(32),
                DESCRIPTION				VARCHAR(500),
                ACTIVE_DATE				DATE,
                IS_ACTIVE				TINYINT,
                VERSION					FLOAT,
                STACK_ORDER		        TINYINT,
                ADMIN_ONLY              TINYINT
            ) TYPE INNODB
        </sql>
        <sql db_lang="oracle">
            CREATE TABLE {table_prefix}XPS_MODULE
            (
                MODULE_ID				VARCHAR2(32) PRIMARY KEY,
                MODULE_NAME				VARCHAR2(32),
                DESCRIPTION				VARCHAR2(500),
                ACTIVE_DATE				DATE,
                IS_ACTIVE				NUMBER(5),
                VERSION					FLOAT,
                STACK_ORDER		        NUMBER(5),
                ADMIN_ONLY              NUMBER(5)
            )
        </sql>
    </sql_statement>
    <sql_statement id="create_xps_widget">
        <sql db_lang="default">
            CREATE TABLE {table_prefix}XPS_WIDGET
            (
                WIDGET_ID				VARCHAR(32) PRIMARY KEY,
                WIDGET_NAME				VARCHAR(32),
                MODULE_ID				VARCHAR(32),
                DESCRIPTION				VARCHAR(500),
                URL						VARCHAR(500),
                CONTAINER_ID			VARCHAR(50),
                STACK_ORDER				TINYINT,
                PREFERENCES				VARCHAR(1000),
                ACTIVE_DATE				DATE,
                VERSION					FLOAT
            ) TYPE INNODB
        </sql>
        <sql db_lang="oracle">
            CREATE TABLE {table_prefix}XPS_WIDGET
            (
                WIDGET_ID				VARCHAR2(32) PRIMARY KEY,
                WIDGET_NAME				VARCHAR2(32),
                MODULE_ID				VARCHAR2(32),
                DESCRIPTION				VARCHAR2(500),
                URL						VARCHAR2(500),
                CONTAINER_ID			VARCHAR2(50),
                STACK_ORDER				NUMBER(5),
                PREFERENCES				VARCHAR(1000),
                ACTIVE_DATE				DATE,
                VERSION					FLOAT
            )
        </sql>
    </sql_statement>
    <sql_statement id="create_xps_module_install_log">
        <sql db_lang="default">
            CREATE TABLE {table_prefix}XPS_MODULE_INSTALL_LOG
            (
                MODULE_ID			VARCHAR(32),
                MODULE_OBJECT_NAME	VARCHAR(64),
                MODULE_OBJECT_TYPE	VARCHAR(64),
                PRIMARY KEY(MODULE_OBJECT_NAME, MODULE_OBJECT_TYPE)
            ) TYPE INNODB
        </sql>
        <sql db_lang="oracle">
            CREATE TABLE {table_prefix}XPS_MODULE_INSTALL_LOG
            (
                MODULE_ID			VARCHAR2(32),
                MODULE_OBJECT_NAME	VARCHAR2(64),
                MODULE_OBJECT_TYPE	VARCHAR2(64),
                PRIMARY KEY(MODULE_OBJECT_NAME, MODULE_OBJECT_TYPE)
            )
        </sql>
    </sql_statement>
    <sql_statement id="create_xps_link">
        <sql db_lang="default">
            CREATE TABLE {table_prefix}XPS_LINK
            (
                LINK_ID				VARCHAR(32) PRIMARY KEY,
                LINK_NAME   		VARCHAR(150),
                LINK_URL        	VARCHAR(500),
                STACK_ORDER TINYINT
            ) TYPE INNODB
        </sql>
        <sql db_lang="oracle">
            CREATE TABLE {table_prefix}XPS_LINK
            (
                LINK_ID				VARCHAR2(32) PRIMARY KEY,
                LINK_NAME   		VARCHAR2(150),
                LINK_URL        	VARCHAR2(500),
                STACK_ORDER 		NUMBER(5)
            )
        </sql>
    </sql_statement>
    <sql_statement id="create_xps_user_widget_pref">
        <sql db_lang="default">
            CREATE TABLE {table_prefix}XPS_USER_WIDGET_PREF
            (
                USER_ID					VARCHAR(20),
                WIDGET_ID				VARCHAR(32),
                CONTAINER_ID			VARCHAR(50),
                STACK_ORDER				TINYINT,
                PRIMARY KEY(USER_ID, WIDGET_ID)
            ) TYPE INNODB
        </sql>
        <sql db_lang="oracle">
            CREATE TABLE {table_prefix}XPS_USER_WIDGET_PREF
            (
                USER_ID					VARCHAR2(20),
                WIDGET_ID				VARCHAR2(32),
                CONTAINER_ID			VARCHAR2(50),
                STACK_ORDER				NUMBER(5),
                PRIMARY KEY(USER_ID, WIDGET_ID)
            )
        </sql>
    </sql_statement>

<!--CREATE CONSTRAINTS-->
    <sql_statement id="create_constraint_fk_mod2wid">
        <sql db_lang="default">
            ALTER TABLE {table_prefix}XPS_WIDGET ADD CONSTRAINT FK_MOD2WID FOREIGN KEY (MODULE_ID) REFERENCES {table_prefix}XPS_MODULE(MODULE_ID) ON DELETE CASCADE
        </sql>
    </sql_statement>
    <sql_statement id="create_constraint_fk_log2mod">
        <sql db_lang="default">
            ALTER TABLE {table_prefix}XPS_MODULE_INSTALL_LOG ADD CONSTRAINT FK_LOG2MOD FOREIGN KEY (MODULE_ID) REFERENCES {table_prefix}XPS_MODULE(MODULE_ID) ON DELETE CASCADE
        </sql>
    </sql_statement>
    <sql_statement id="create_constraint_fk_xuwp2user">
        <sql db_lang="default">
            ALTER TABLE {table_prefix}XPS_USER_WIDGET_PREF ADD CONSTRAINT FK_XUWP2USER FOREIGN KEY (USER_ID) REFERENCES {table_prefix}XPS_USER(USER_ID) ON DELETE CASCADE
        </sql>
    </sql_statement>
    <sql_statement id="create_constraint_fk_xuwp2wid">
        <sql db_lang="default">
           ALTER TABLE {table_prefix}XPS_USER_WIDGET_PREF ADD CONSTRAINT FK_XUWP2WID FOREIGN KEY (WIDGET_ID) REFERENCES {table_prefix}XPS_WIDGET(WIDGET_ID) ON DELETE CASCADE
        </sql>
    </sql_statement>

<!--INSERT DEFAULTS-->
    <sql_statement id="insert_main_module">
        <sql db_lang="default">
            INSERT INTO {table_prefix}XPS_MODULE
            (
                MODULE_ID,
                MODULE_NAME,
                DESCRIPTION,
                ACTIVE_DATE,
                IS_ACTIVE,
                VERSION,
                STACK_ORDER,
                ADMIN_ONLY
            )
            VALUES
            (
                'core',
                'Core',
                'Main module',
                NOW(),
                1,
                1.0,
                0,
                0
            )
        </sql>
        <sql db_lang="oracle">
            INSERT INTO {table_prefix}XPS_MODULE
            (
                MODULE_ID,
                MODULE_NAME,
                DESCRIPTION,
                ACTIVE_DATE,
                IS_ACTIVE,
                VERSION,
                STACK_ORDER,
                ADMIN_ONLY
            )
            VALUES
            (
                'core',
                'Core',
                'Main module',
                SYSDATE,
                1,
                1.0,
                0,
                0
            )
        </sql>
    </sql_statement>
    <sql_statement id="insert_navigation">
        <sql db_lang="default">
            INSERT INTO {table_prefix}XPS_WIDGET
            (
                WIDGET_ID,
                WIDGET_NAME,
                MODULE_ID,
                URL,
                ACTIVE_DATE,
                CONTAINER_ID
            )
            VALUES
            (
                'core_navigation',
                'Navigation',
                'core',
                'core_navigation.php',
                NOW(),
                'right_active_widget_container'
            )
        </sql>
        <sql db_lang="oracle">
            INSERT INTO {table_prefix}XPS_WIDGET
            (
                WIDGET_ID,
                WIDGET_NAME,
                MODULE_ID,
                URL,
                ACTIVE_DATE,
                CONTAINER_ID
            )
            VALUES
            (
                'core_navigation',
                'Navigation',
                'core',
                'core_navigation.php',
                SYSDATE,
                'right_active_widget_container'
            )
        </sql>
    </sql_statement>
</sql_statements>
Return current item: EXtensible Production Suite (XPS)