Skip to content
Compare
Choose a tag to compare
@aquamarine5 aquamarine5 released this 18 Jan 16:59
· 5 commits to main since this release

What's Changed

  • Bump nanoid from 3.3.7 to 3.3.8 in /xiaolianvue in the npm_and_yarn group across 1 directory by @dependabot in #18
  • 0.8: Revolution of MySQL Structure, isAnalyserEnabled for vacation by @aquamarine5 in #19

About SQL Structure Migration

Important

If you are using the previous version (<0.8) of XiaolianShowerSense, only update the jar version will cause serious error.
So please read the documentation of migration completely.

  • All isDatabaseExisted(), CheckDatabase() is deleted, use isDatabaseEmpty() and setupDatabase() instead.
  • Now timePos start with '3' because of the limit of SMALLINT UNSIGNED
  • Now all tables will create in the constructor().
  • Now analyses.count default value is 0 not 1.
  • RENAME TABLE data TO config;
  • ALTER TABLE config ADD COLUMN isAnalysisEnabled BOOLEAN NOT NULL DEFAULT TRUE;
  • <ResidenceId> for residence showers is deprecated.
  • <ResidenceId>_analysis for analyses is deprecated.
  • for residenceIndex: ALTER TABLE residenceIndex MODIFY COLUMN analyseStartTime, analyseEndTime MEDIUMINT UNSIGNED
  • for config (previously data):
ALTER TABLE config 
MODIFY COLUMN avgWashTime MEDIUMINT UNSIGNED,
MODIFY COLUMN avgWashCount MEDIUMINT UNSIGNED,
MODIFY COLUMN requestTimes MEDIUMINT UNSIGNED;
  • Migrate from <ResidenceId> and <ResidenceId>_analysis:
CREATE TABLE xiaolian.showers (
    deviceId INT PRIMARY KEY,
    location VARCHAR(50) NOT NULL,
    displayNo TINYINT(3) NOT NULL,
    status TINYINT(2) NOT NULL,
    lastUsedTime TIMESTAMP NOT NULL,
    lastWashTime TIMESTAMP NOT NULL,
    residenceId INT NOT NULL
) CHARACTER SET utf8mb4;

CREATE TABLE xiaolian.analyses (
    minv SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    avgv SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    maxv SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    timePos SMALLINT UNSIGNED NOT NULL,
    count SMALLINT UNSIGNED NOT NULL DEFAULT 0,
    residenceId INT UNSIGNED NOT NULL,
    PRIMARY KEY (residenceId, timePos)
) CHARACTER SET utf8mb4;
  • for analyses (previously analysis):
INSERT INTO analyses (minv, avgv, maxv, timePos, count, residenceId)
SELECT minv, avgv, maxv, timePos - 50000, count, ${ResidenceId}
FROM ${ResidenceId}_analysis;
  • for showers (previously identified by residenceId):
INSERT INTO showers (deviceId, location, displayNo, status, lastUsedTime, lastWashTime, residenceId)
SELECT deviceId, location, displayNo, status, lastUsedTime, lastWashTime, ${ResidenceId}
FROM xiaolian.${ResidenceId};
  • Finally, drop all deprecated table.

Full Changelog: 0.7...0.8