<?xml version="1.0" encoding="UTF-8"?>
<!--
 This file is part of the Meeds project (https://meeds.io/).

 Copyright (C) 2020 - 2025 Meeds Association contact@meeds.io

 This program is free software; you can redistribute it and/or
 modify it under the terms of the GNU Lesser General Public
 License as published by the Free Software Foundation; either
 version 3 of the License, or (at your option) any later version.
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 Lesser General Public License for more details.

 You should have received a copy of the GNU Lesser General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-->
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
                      http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.4.xsd">

  <!-- Managing both DB that use sequences and db that use auto increment -->
  <property name="autoIncrement" value="true" dbms="mysql,mssql,h2,hsqldb" />
  <property name="autoIncrement" value="false" dbms="oracle,postgresql" />

  <!-- Site -->
  <changeSet author="portal" id="1.0.0-6">
    <createTable tableName="PORTAL_SITES">
      <column name="ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_SITE"/>
      </column>
      <column name="TYPE" type="INT"/>
      <column name="NAME" type="NVARCHAR(200)"/>
      <column name="LOCALE" type="VARCHAR(20)" />
      <column name="SKIN" type="NVARCHAR(200)"/>
      <column name="LABEL" type="NVARCHAR(200)"/>
      <column name="DESCRIPTION" type="LONGTEXT" />
      <column name="PROPERTIES" type="LONGTEXT"/>
      <column name="SITE_BODY" type="LONGTEXT" />
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-7" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_SITE_ID_GENERATOR" startValue="1"/>
  </changeSet>
  <changeSet author="portal" id="1.0.0-8">
    <addUniqueConstraint columnNames="TYPE, NAME" constraintName="UK_PORTAL_SITE_NAME_TYPE"
                         tableName="PORTAL_SITES"/>
  </changeSet>

  <!-- Page -->
  <changeSet author="portal" id="1.0.0-9">
    <validCheckSum>ANY</validCheckSum>
    <createTable tableName="PORTAL_PAGES">
      <column name="ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_PAGE"/>
      </column>
      <column name="SITE_ID" type="BIGINT">
        <constraints nullable="false"/>
      </column>
      <column name="SHOW_MAX_WINDOW" type="BOOLEAN" defaultValueBoolean="false" />
      <column name="DISPLAY_NAME" type="NVARCHAR(200)"/>
      <column name="NAME" type="NVARCHAR(200)"/>
      <column name="DESCRIPTION" type="LONGTEXT" />
      <column name="FACTORY_ID" type="NVARCHAR(200)"/>
      <column name="PAGE_BODY" type="LONGTEXT" />
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-10" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_PAGE_ID_GENERATOR" startValue="1"/>
  </changeSet>
  <changeSet author="portal" id="1.0.0-11">
    <addForeignKeyConstraint constraintName="FK_PORTAL_PAGE_SITE"
                             baseTableName="PORTAL_PAGES" baseColumnNames="SITE_ID"
                             referencedTableName="PORTAL_SITES" referencedColumnNames="ID"
                             onDelete="CASCADE" onUpdate="NO ACTION" />
    <addUniqueConstraint columnNames="SITE_ID, NAME" constraintName="UK_PORTAL_SITE_PAGE_NAME"
                         tableName="PORTAL_PAGES"/>
  </changeSet>

  <!-- Navigation -->
  <changeSet author="portal" id="1.0.0-12">
    <createTable tableName="PORTAL_NAVIGATION_NODES">
      <column name="NODE_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_NAVIGATION_NODE"/>
      </column>
      <column name="NAME" type="NVARCHAR(200)"/>
      <column name="LABEL" type="NVARCHAR(200)"/>
      <column name="ICON" type="NVARCHAR(200)"/>
      <column name="START_TIME" type="BIGINT"/>
      <column name="END_TIME" type="BIGINT"/>
      <column name="VISIBILITY" type="INT"/>
      <column name="NODE_INDEX" type="INT"/>
      <column name="PAGE_ID" type="BIGINT">
        <constraints nullable="true" />
      </column>
      <column name="PARENT_ID" type="BIGINT">
        <constraints nullable="true" />
      </column>
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-13" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_GTN_NAVIGATION_NODE_ID" startValue="1"/>
  </changeSet>
  <changeSet id="portal" author="1.0.0-14">
    <addForeignKeyConstraint constraintName="FK_PORTAL_NODE_PAGE"
                             baseTableName="PORTAL_NAVIGATION_NODES" baseColumnNames="PAGE_ID"
                             referencedTableName="PORTAL_PAGES" referencedColumnNames="ID"
                             onDelete="SET NULL" onUpdate="NO ACTION" />
    <addForeignKeyConstraint constraintName="FK_PORTAL_NODE_PARENT"
                             baseTableName="PORTAL_NAVIGATION_NODES" baseColumnNames="PARENT_ID"
                             referencedTableName="PORTAL_NAVIGATION_NODES" referencedColumnNames="NODE_ID"
                             onDelete="CASCADE" onUpdate="NO ACTION" />
  </changeSet>
  <changeSet author="portal" id="1.0.0-15">
    <createTable tableName="PORTAL_NAVIGATIONS">
      <column name="NAVIGATION_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_NAVIGATION"/>
      </column>
      <column name="SITE_ID" type="BIGINT">
        <constraints nullable="false"/>
      </column>
      <column name="PRIORITY" type="INT"/>
      <column name="NODE_ID" type="BIGINT">
        <constraints nullable="true"/>
      </column>
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-16" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_GTN_NAVIGATION_ID" startValue="1"/>
  </changeSet>
  <changeSet author="portal" id="1.0.0-17">
    <addForeignKeyConstraint constraintName="FK_PORTAL_NAV_NODE"
                             baseTableName="PORTAL_NAVIGATIONS" baseColumnNames="NODE_ID"
                             referencedTableName="PORTAL_NAVIGATION_NODES" referencedColumnNames="NODE_ID"
                             onDelete="CASCADE" onUpdate="NO ACTION" />
    <addForeignKeyConstraint constraintName="FK_PORTAL_NAV_SITE"
                             baseTableName="PORTAL_NAVIGATIONS" baseColumnNames="SITE_ID"
                             referencedTableName="PORTAL_SITES" referencedColumnNames="ID"
                             onDelete="CASCADE" onUpdate="NO ACTION" />
  </changeSet>



  <changeSet author="portal" id="1.0.0-18">
    <createTable tableName="PORTAL_DESCRIPTIONS">
      <column name="DESCRIPTION_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_DESCRIPTIONS"/>
      </column>
      <column name="REF_ID" type="VARCHAR(200)"/>
      <column name="NAME" type="NVARCHAR(200)"/>
      <column name="DESCRIPTION" type="NVARCHAR(200)"/>
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-19" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_PORTAL_DESCRIPTIONS_ID" startValue="1"/>
  </changeSet>

  <changeSet author="portal" id="1.0.0-20">
    <createTable tableName="PORTAL_DESCRIPTION_LOCALIZED">
      <column name="DESCRIPTION_ID" type="BIGINT"/>
      <column name="LOCALE" type="VARCHAR(20)"/>
      <column name="NAME" type="NVARCHAR(200)"/>
      <column name="DESCRIPTION" type="NVARCHAR(200)"/>
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-21">
    <addForeignKeyConstraint constraintName="FK_PORTAL_DESCRIPTION_LOCALIZED_DESCRIPTION_ID"
                             baseTableName="PORTAL_DESCRIPTION_LOCALIZED"
                             baseColumnNames="DESCRIPTION_ID"
                             referencedTableName="PORTAL_DESCRIPTIONS"
                             referencedColumnNames="DESCRIPTION_ID"
                             onDelete="CASCADE"
                             onUpdate="NO ACTION"
    />
  </changeSet>

  <!-- Portal/Page Layout -->
  <changeSet author="portal" id="1.0.0-22">
    <createTable tableName="PORTAL_CONTAINERS">
      <column name="ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_CONTAINER"/>
      </column>
      <column name="WEBUI_ID" type="VARCHAR(200)"/>
      <column name="NAME" type="NVARCHAR(200)"/>
      <column name="ICON" type="NVARCHAR(200)"/>
      <column name="TEMPLATE" type="NVARCHAR(500)"/>
      <column name="FACTORY_ID" type="NVARCHAR(200)"/>
      <column name="TITLE" type="NVARCHAR(200)"/>
      <column name="DESCRIPTION" type="LONGTEXT" />
      <column name="WIDTH" type="VARCHAR(20)"/>
      <column name="HEIGHT" type="VARCHAR(20)"/>
      <column name="PROPERTIES" type="LONGTEXT" />
      <column name="CONTAINER_BODY" type="LONGTEXT" />
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-23">
    <validCheckSum>ANY</validCheckSum>
    <createTable tableName="PORTAL_WINDOWS">
      <column name="ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_WINDOW"/>
      </column>
      <column name="TITLE" type="NVARCHAR(200)"/>
      <column name="ICON" type="NVARCHAR(200)"/>
      <column name="DESCRIPTION" type="LONGTEXT" />
      <column name="SHOW_INFO_BAR" type="BOOLEAN" defaultValueBoolean="false" />
      <column name="SHOW_APP_STATE" type="BOOLEAN" defaultValueBoolean="false" />
      <column name="SHOW_APP_MODE" type="BOOLEAN" defaultValueBoolean="false" />
      <column name="THEME" type="NVARCHAR(200)"/>
      <column name="WIDTH" type="VARCHAR(20)"/>
      <column name="HEIGHT" type="VARCHAR(20)"/>
      <column name="PROPERTIES" type="LONGTEXT" />
      <column name="APP_TYPE" type="INT"/>
      <column name="CONTENT_ID" type="NVARCHAR(200)"/>
      <column name="CUSTOMIZATION" type="BLOB"/>
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-24" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_CONTAINER_ID_GENERATOR" startValue="1"/>
    <createSequence sequenceName="SEQ_WINDOW_ID_GENERATOR" startValue="1"/>
  </changeSet>

  <!-- Permission -->
  <changeSet author="portal" id="1.0.0-25">
    <createTable tableName="PORTAL_PERMISSIONS">
      <column name="PERMISSION_ID" type="BIGINT" autoIncrement="${autoIncrement}" startWith="1">
        <constraints nullable="false" primaryKey="true" primaryKeyName="PK_PORTAL_PERMISSIONS"/>
      </column>
      <column name="REF_TYPE" type="VARCHAR(200)">
        <constraints nullable="false"/>
      </column>
      <column name="REF_ID" type="BIGINT">
        <constraints nullable="false"/>
      </column>
      <column name="PERMISSION" type="NVARCHAR(200)"/>
      <column name="TYPE" type="INT"/>
    </createTable>
    <modifySql dbms="mysql">
      <append value=" ENGINE=INNODB CHARSET=UTF8 COLLATE utf8_general_ci" />
    </modifySql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-26" dbms="oracle,postgresql">
    <createSequence sequenceName="SEQ_PORTAL_PERMISSIONS_ID" startValue="1"/>
  </changeSet>
  <changeSet author="portal" id="1.0.0-27">
    <addUniqueConstraint columnNames="REF_TYPE, REF_ID, PERMISSION, TYPE" constraintName="UK_PORTAL_PERMISSIONS"
                         tableName="PORTAL_PERMISSIONS"/>
  </changeSet>

  <changeSet author="portal" id="1.0.0-28">
    <addColumn tableName="PORTAL_SITES">
      <column name="DEFAULT_SITE_BODY" type="BOOLEAN" defaultValueBoolean="false" />
    </addColumn>
  </changeSet>

  <changeSet author="portal" id="1.0.0-29" dbms="hsqldb">
    <validCheckSum>ANY</validCheckSum>
    <createSequence sequenceName="SEQ_SITE_ID_GENERATOR" startValue="1" />
    <createSequence sequenceName="SEQ_PAGE_ID_GENERATOR" startValue="1" />
    <createSequence sequenceName="SEQ_GTN_NAVIGATION_NODE_ID" startValue="1" />
    <createSequence sequenceName="SEQ_GTN_NAVIGATION_ID" startValue="1" />
    <createSequence sequenceName="SEQ_PORTAL_DESCRIPTIONS_ID" startValue="1" />
    <createSequence sequenceName="SEQ_CONTAINER_ID_GENERATOR" startValue="1" />
    <createSequence sequenceName="SEQ_WINDOW_ID_GENERATOR" startValue="1" />
    <createSequence sequenceName="SEQ_PORTAL_PERMISSIONS_ID" startValue="1" />
  </changeSet>

  <changeSet author="portal" id="1.0.0-30" dbms="postgresql">
    <preConditions onFail="MARK_RAN">
      <sqlCheck expectedResult="bytea">
        SELECT DATA_TYPE FROM information_schema.columns where table_name = 'portal_windows' and column_name = 'customization'
      </sqlCheck>
    </preConditions>
    <sql>
      ALTER TABLE PORTAL_WINDOWS ADD COLUMN customization_oid oid;
      UPDATE PORTAL_WINDOWS SET customization_oid = lo_from_bytea(0, customization);
      ALTER TABLE PORTAL_WINDOWS DROP COLUMN customization;
      ALTER TABLE PORTAL_WINDOWS RENAME COLUMN customization_oid TO customization;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-31">
    <addColumn tableName="PORTAL_PAGES">
      <column name="HIDE_SHARED_LAYOUT" type="BOOLEAN" defaultValueBoolean="false" />
    </addColumn>
  </changeSet>

  <changeSet author="portal" id="1.0.0-32">
    <addColumn tableName="PORTAL_PAGES">
      <column name="PAGE_TYPE" type="INT" defaultValueNumeric="0" >
        <constraints nullable="false" />
      </column>
      <column name="LINK" type="TEXT" />
    </addColumn>
    <addColumn tableName="PORTAL_NAVIGATION_NODES">
      <column name="TARGET" type="INT" defaultValueNumeric="0" >
        <constraints nullable="false" />
      </column>
    </addColumn>
  </changeSet>
  <changeSet author="portal" id="1.0.0-33">
    <addColumn tableName="PORTAL_NAVIGATION_NODES">
      <column name="UPDATED_DATE" type="BIGINT" defaultValueNumeric="0" />
    </addColumn>
  </changeSet>
  <changeSet author="portal" id="1.0.0-34" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_SITES MODIFY COLUMN DESCRIPTION longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>
  <changeSet author="portal" id="1.0.0-35">
    <addColumn tableName="PORTAL_SITES">
      <column name="DISPLAYED" type="BOOLEAN" defaultValueBoolean="true" />
      <column name="DISPLAY_ORDER" type="INT" defaultValueNumeric="0" />
    </addColumn>
  </changeSet>
  <changeSet author="portal" id="1.0.0-36">
    <addColumn tableName="PORTAL_SITES">
      <column name="BANNER_FILE_ID" type="BIGINT" defaultValueNumeric="0" />
    </addColumn>
  </changeSet>

  <!-- Add index for performance -->
  <changeSet author="portal" id="1.0.0-37">
    <preConditions onFail="MARK_RAN">
      <not><indexExists indexName="IDX_PORTAL_SITES_TYPE_01" tableName="PORTAL_SITES"/></not>
      <not><indexExists indexName="IDX_PORTAL_SITES_NAME_01" tableName="PORTAL_SITES"/></not>
      <not><indexExists indexName="IDX_PORTAL_LOCALE_01" tableName="PORTAL_SITES"/></not>
      <not><indexExists indexName="IDX_PORTAL_SKIN_01" tableName="PORTAL_SITES"/></not>
      <not><indexExists indexName="IDX_PORTAL_LABEL_01" tableName="PORTAL_SITES"/></not>
    </preConditions>
    <createIndex indexName="IDX_PORTAL_SITES_TYPE_01"
                 tableName="PORTAL_SITES">
      <column name="TYPE" type="INT"/>
    </createIndex>
    <createIndex indexName="IDX_PORTAL_SITES_NAME_01"
                 tableName="PORTAL_SITES">
      <column name="NAME" type="NVARCHAR(200)"/>
    </createIndex>
    <createIndex indexName="IDX_PORTAL_LOCALE_01"
                 tableName="PORTAL_SITES">
      <column name="LOCALE" type="NVARCHAR(200)"/>
    </createIndex>
    <createIndex indexName="IDX_PORTAL_SKIN_01"
                 tableName="PORTAL_SITES">
      <column name="SKIN" type="NVARCHAR(200)"/>
    </createIndex>
    <createIndex indexName="IDX_PORTAL_LABEL_01"
                 tableName="PORTAL_SITES">
      <column name="LABEL" type="NVARCHAR(200)"/>
    </createIndex>
  </changeSet>

  <!-- Add index for performance -->
  <changeSet author="portal" id="1.0.0-38">
    <preConditions onFail="MARK_RAN">
      <not><indexExists indexName="IDX_PORTAL_SITES_DISPLAYED_01" tableName="PORTAL_SITES"/></not>
      <not><indexExists indexName="IDX_PORTAL_SITES_DISPLAY_ORDER_01" tableName="PORTAL_SITES"/></not>
      <not><indexExists indexName="IDX_PORTAL_SITES_BANNER_FILE_ID_01" tableName="PORTAL_SITES"/></not>
    </preConditions>
    <createIndex indexName="IDX_PORTAL_SITES_DISPLAYED_01"
                 tableName="PORTAL_SITES">
      <column name="DISPLAYED" type="BOOLEAN"/>
    </createIndex>
    <createIndex indexName="IDX_PORTAL_SITES_DISPLAY_ORDER_01"
                 tableName="PORTAL_SITES">
      <column name="DISPLAY_ORDER" type="INT"/>
    </createIndex>
    <createIndex indexName="IDX_PORTAL_SITES_BANNER_FILE_ID_01"
                 tableName="PORTAL_SITES">
      <column name="BANNER_FILE_ID" type="BIGINT"/>
    </createIndex>
  </changeSet>

  <changeSet author="portal" id="1.0.0-39">
    <validCheckSum>ANY</validCheckSum>
    <sql dbms="mysql">
      UPDATE PORTAL_SITES set DISPLAYED=1 where NAME LIKE '/spaces/%';
    </sql>
    <sql dbms="postgresql">
      UPDATE PORTAL_SITES set DISPLAYED=true where NAME LIKE '/spaces/%';
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-40">
    <addColumn tableName="PORTAL_PAGES">
      <column name="PROFILES" type="NVARCHAR(2000)" />
    </addColumn>
  </changeSet>

  <changeSet author="portal" id="1.0.0-41" dbms="mysql">
      <sql>
          ALTER TABLE PORTAL_PAGES MODIFY COLUMN DISPLAY_NAME varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
      </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-42" dbms="mysql">
  <!-- Change 'CUSTOMIZATION' column Length in MySQL only in order to correspond to used Column length in Postgres which already uses OID Data Type -->
    <validCheckSum>ANY</validCheckSum>
    <modifyDataType tableName="PORTAL_WINDOWS" columnName="CUSTOMIZATION" newDataType="LONGBLOB" />
  </changeSet>

  <changeSet author="portal" id="1.0.0-43">
    <modifyDataType tableName="PORTAL_CONTAINERS" columnName="WIDTH" newDataType="NVARCHAR(200)" />
  </changeSet>

  <changeSet author="portal" id="1.0.0-44" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_SITES MODIFY COLUMN LABEL varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-45" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_SITES MODIFY COLUMN SITE_BODY longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-46" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_SITES MODIFY COLUMN PROPERTIES longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-47" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_PAGES MODIFY COLUMN DESCRIPTION longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-48" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_PAGES MODIFY COLUMN PAGE_BODY longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-49" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_NAVIGATION_NODES MODIFY COLUMN LABEL varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-50" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_CONTAINERS MODIFY COLUMN PROPERTIES longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-51" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_CONTAINERS MODIFY COLUMN CONTAINER_BODY longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-52" dbms="mysql">
    <sql>
      ALTER TABLE PORTAL_WINDOWS MODIFY COLUMN PROPERTIES longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
    </sql>
  </changeSet>

  <changeSet author="portal" id="1.0.0-mip-159-01">
    <addColumn tableName="PORTAL_PAGES">
      <column name="SHOW_SHARED_LAYOUT" type="BOOLEAN" defaultValueBoolean="false" />
    </addColumn>
  </changeSet>

</databaseChangeLog>
