Skip to main content

9A1.Upgrade 2.4.2.201

trydoforOriginalPracticeUpgradeAbout 1 min

9A1.Upgrade 2.4.2.201

Upgraded build 200 to 201, closer to flywave's engineering practices, with the following major incompatibility,

  • Adjusted pom.xml structure, former wings-home renamed to wings-project
  • flywave journal management using the new trigger form
  • flywave default confirm all, no interaction, need to set askYes manually
  • check wings notable changelog

9A1.1.Maven Setting

Change POM's parent from wings-home:2.4.2.200-SNAPSHOT to wings-project:2.4.2.201-SNAPSHOT

<parent>
    <groupId>pro.fessional</groupId>
    <artifactId>wings-project</artifactId>
    <version>2.4.2.201-SNAPSHOT</version>
</parent>

9A1.2.Table Restruct

Execute the operations in the following order

  • Execute 2021-12-20v01-journal-trg-insert.sql to add new journal structure
  • Execute JournalManager.manageTriggers(table, true) to delete the old trigger
  • Execute JournalManager.checkAndInitDdl(table, cid) to replace the old config to new
  • Execute JournalManager.publishInsert/Update/Delete(table, true, cid) to generate a new trigger

If you need to import the data from the original trace table into the new one, and you want to keep the old data and the new data in the same _id incremental order. then you need to set AUTO_INCREMENT manually so that it is greater than the total number of data in the old table. And manually update the inserted data _id during the operation.

ALTER TABLE table$log AUTO_INCREMENT = $count;
UPDATE table$log set _id = $count + _id;

If you do not care about the order, or have set AUTO_INCREMENT to start, execute the following SQL to import the data,

SET @tabl = 'win_user_basis';
SET @cols = (
    SELECT CONCAT('`', GROUP_CONCAT(COLUMN_NAME SEPARATOR '`, `'), '`')
    FROM INFORMATION_SCHEMA.COLUMNS
    WHERE TABLE_SCHEMA = database() AND TABLE_NAME = @tabl
    ORDER BY ORDINAL_POSITION
);
SET @restoreSql = CONCAT(
        'INSERT INTO ', @tabl, '$log'
            ' SELECT NULL, _dt, _tp, ', @cols,' FROM ((SELECT *,\'U\' as _tp FROM ',
        @tabl, '$upd) UNION (SELECT *,\'D\' as _tp FROM ',
        @tabl, '$del)) as old ORDER BY _dt');

SELECT @restoreSql;

PREPARE stmt FROM @restoreSql;
EXECUTE stmt;

9A1.3.Compile Error

Set the method of InteractiveManager according to the compile prompt. If your ever use flywave to manage datas and tables in automatic environment (batch, web), you need to define your own InteractiveManager.askWay implementation. Default implementations are,

  • FlywaveInteractiveTty based on console
  • FlywaveInteractiveGui based on Swing dialog

If HeadlessException is thrown at startup, it is possible that AWT Font, Color, etc. are used before wings.

at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)

Needs set in the code System.setProperty("java.awt.headless", "false"); closest to or before the main method, Or set -Djava.awt.headless=false to jvm parameters.

9A1.4.DataSource Change

For the data sharding or R/W separation scenario, split the faceless shard project, so that the DataSource uses the Spring format by default.

# Replace with spring default data source
spring.datasource.url
spring.datasource.username
spring.datasource.password