Skip to content

Commit

Permalink
Merge pull request #26 from kagemomiji/issue25-bump-up-hsql-2.7.1
Browse files Browse the repository at this point in the history
Update #25 bump up hsql 2.7.1
  • Loading branch information
kagemomiji authored Dec 26, 2022
2 parents df2573d + 9ec594b commit 1c3a08e
Show file tree
Hide file tree
Showing 10 changed files with 88 additions and 2,909 deletions.
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ The following is an incomplete list of features that are enhanced from Airsonic:
- MariaDB
- Uses failsafe for integration testing instead of cucumber
- Build and deployment
- An updated Docker image with JRE 14 base layer.
- An updated Docker image with JRE 17 base layer.
- Add support for XMP to support playing MOD files out of the box
- Multiplatform builds, including for ARM v7 and ARM64
- A more advanced build pipeline including automatic releases and deploys at merge
- Allows people to grab the newest build without compiling from source as soon as features/enhancements are merged, instead of waiting for the next stable build (which may be months away)
- Available on GHCR as well as Docker Hub
- Available on GHCR
- Stepbacks
- The Java Jukebox has been removed, due to the third-party library not being kept up to date with modern JVMs. See [PR #636](https://github.com/airsonic-advanced/airsonic-advanced/pull/636).

Expand Down Expand Up @@ -137,7 +137,7 @@ Airsonic-Advanced is run similarly to (and in lieu of) vanilla Airsonic.
Read the [compatibility notes](#compatibility-notes).

### Docker
Docker releases are at [DockerHub](https://hub.docker.com/r/airsonicadvanced/airsonic-advanced) and [GHCR](https://ghcr.io/kagemomiji/airsonic-advanced). Docker releases are recently multiplatform, which means ARMv7 and ARM64 are also released to Dockerhub. However, automated testing for those archs is not currently done in the CI/CD pipeline (only Linux platform is tested).
[GHCR](https://ghcr.io/kagemomiji/airsonic-advanced). Docker releases are recently multiplatform, which means ARMv7 and ARM64 are also released to Dockerhub. However, automated testing for those archs is not currently done in the CI/CD pipeline (only Linux platform is tested).

Please note that for Docker images, the volume mounting points have changed and are different from Airsonic. Airsonic mount points are at `/airsonic/*` inside the container. Airsonic-Advanced tries to use the same volume locations as the default war image at `/var/*` in order to remain consistent if people want to switch between the containers and non-containers.
- `Music:/airsonic/music` -> `Music:/var/music`
Expand Down Expand Up @@ -197,6 +197,10 @@ Other properties are obsolete and have been removed:

First migration to 11.x will create a backup DB next to the DB folder. It will be marked as `db.backup.<timestamp>`. Use this folder as the DB if a revert to an older major version is needed (11.0 -> 10.6.0).

> **Warning**
If you use HSQLDB for 10.6.0, DB migration must fails.
First upgrade to 11.0.0-SNAPSHOT.20221224143241 then upgrade to latest release.

History
-----

Expand All @@ -215,6 +219,8 @@ based on the Subsonic codebase that is free, open source, and community driven.

Around November 2019, Airsonic-Advanced was forked off the base Airsonic fork due to differences in pace and review of development. Several key features of the framework were outdated, and attempts to upgrade them occasionally took upto a year. Airsonic-Advanced tries a modern implementation and bleeding edge approach to development, and is thus usually ahead of the base fork in dependencies and features.

December 2022, this repository forked from Airsonic-Advanced.

Pull Requests are always welcome. All Pull Requests are reviewed before being merged to ensure we continue to meet our goals.

License
Expand Down
9 changes: 7 additions & 2 deletions airsonic-main/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<chameleon.version>2.0.0-RELEASE</chameleon.version>
<tomcat.server.scope>provided</tomcat.server.scope>
<!-- For fixing import/export due to https://github.com/liquibase/liquibase/issues/1598 -->
<liquibase.version>4.6.2</liquibase.version>
<liquibase.version>4.18.0</liquibase.version>
</properties>

<dependencies>
Expand Down Expand Up @@ -249,9 +249,14 @@
<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>2.5.0</version>
<version>2.7.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.vdurmont</groupId>
<artifactId>semver4j</artifactId>
<version>3.1.0</version>
</dependency>

<dependency>
<groupId>net.jthink</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
import liquibase.diff.output.DiffOutputControl;
import liquibase.diff.output.StandardObjectChangeFilter;
import liquibase.integration.commandline.CommandLineUtils;
import liquibase.resource.FileSystemResourceAccessor;
import liquibase.resource.DirectoryResourceAccessor;
import org.airsonic.player.dao.DatabaseDao;
import org.airsonic.player.util.FileUtil;
import org.airsonic.player.util.LambdaUtils;
Expand Down Expand Up @@ -212,7 +212,7 @@ private void runLiquibaseUpdate(Connection connection, Path p) throws Exception
truncateAll(database, connection);
try (Stream<Path> files = Files.list(p)) {
files.sorted().forEach(LambdaUtils.uncheckConsumer(f -> {
Liquibase liquibase = new Liquibase(p.relativize(f).toString(), new FileSystemResourceAccessor(p.toFile()), database);
Liquibase liquibase = new Liquibase(p.relativize(f).toString(), new DirectoryResourceAccessor(p.toFile()), database);
liquibase.update(new Contexts());
}));
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.airsonic.player.util;

import com.vdurmont.semver4j.Semver;
import org.airsonic.player.service.SettingsService;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.StringUtils;
Expand Down Expand Up @@ -45,16 +46,15 @@ public static Connection getHsqlDbConnection(String url, String user, String pas
properties.put("password", password);
return DriverManager.getConnection(url, properties);
}

/**
/**
* Check if a HSQLDB database upgrade will occur and backups are needed.
*
* DB Driver Likely reason Decision
* null - new db or non-legacy false
* - null or !2 something went wrong, we better make copies true
* 1.x 2.x this is the big upgrade true
* 2.x 2.x already up to date false
*
* <=2.5.0 <= 2.5.0 already up to date false
* <=2.5.0 >2.5.1 this is the big upgrade true
* all else true (default)
*
* @return true if a database backup/migration should be performed
Expand Down Expand Up @@ -91,16 +91,15 @@ public static boolean isHsqlDbBackupNeeded(String dbPath, String jdbcUrl) {
return true;
}

if (currentVersion.startsWith("2.")) {
// If the database version is 2.x, it matches the driver major version, the upgrade should be relatively painless.
Semver currentSemver = new Semver(currentVersion);
Semver SEMVER_2_5_1 = new Semver("2.5.1");

if (currentSemver.isGreaterThanOrEqualTo(SEMVER_2_5_1)) {
// If the database version is greater than or equal 2.5.1, the upgrade should be relatively painless.
LOG.debug("HSQLDB database backup not required for driver version {} connecting (and if needed, upgrading) DB version {}", currentVersion, driverVersion);
return false;
} else if (currentVersion.startsWith("1.")) {
// If we're on a 1.x database, we're upgrading to 2.x and need to back up files.
LOG.info("HSQLDB database upgrade needed, from version {} to {}", currentVersion, driverVersion);
return true;
} else {
// If this happens we're on a completely untested version and we don't know what will happen.
// Our DB and our driver are misaligned, we're going to upgrade: need to back up files
LOG.warn("HSQLDB database upgrade needed, from version {} to {}", currentVersion, driverVersion);
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
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.1.xsd">
<property name="binary_type" dbms="hsqldb" value="binary" />
<property name="binary_type" dbms="postgresql" value="bytea" />
<property name="binary_type" value="blob" />
<property name="json_type" dbms="hsqldb" value="clob"/>
Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 1c3a08e

Please sign in to comment.