Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-57765

Improve database migration mechanism to allow extended info to be migrated as well

    Details

      Description

      Background1
      Portlets have the capability to create custom tables in the database. This is performed through <portlet>/WEB-INF/sql/tables.sql.

      tables.sql (SQL Server format)
      create table custom_table (
        custom_id VARCHAR(4) not null
        , custom_value VARCHAR(255) not null
      );
      
      EXECUTE sp_addextendedproperty N'MS_Description', N'My Custom ID', N'SCHEMA', N'dbo', N'TABLE', N'custom_table', N'COLUMN', N'custom_id';
      EXECUTE sp_addextendedproperty N'MS_Description', N'My Value', N'SCHEMA', N'dbo', N'TABLE', N'custom_table', N'COLUMN', N'custom_value';
      

      (Note that column descriptions have been added)

      Background2
      When migrating data from one database to another, tables.sql is not used. Instead, <portlet>/WEB-INF/classes/META-INF/portlet-model-hints.xml model definition is used to generate the SQL to create the table in the destination database.

      portlet-model-hints.xml
      <model-hints>
        <model name="com.example.portal.model.MyCustomModel">
          <field name="custom_id" type="String">
            <hint name="max-length">4</hint>
          </field>
          <field name="custom_value" type="String">
            <hint name="max-length">255</hint>
          </field>
        </model>
      </model-hints>
      

      Probably, this is done to support migrating to a different database (ie: from SQL Server to Oracle).

      Issue
      Extended info like column description is lost in the migration.

      Feature request
      Allow to use tables.sql in Data Migration as well.
      If destination database is the same as origin database, using the original tables.sql would allow these extended information to be migrated as well.

        Attachments

          Activity

            People

            • Assignee:
              support-lep@liferay.com SE Support
              Reporter:
              jordi.rodo Jordi Rodó
            • Votes:
              2 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:

                Packages

                Version Package