Convert to liquibase from handrolled migration tool

Signed-off-by: Andrew DeMaria <lostonamountain@gmail.com>
master
Andrew DeMaria 8 years ago
parent 1d9b7d48c5
commit 4b34bc0139
No known key found for this signature in database
GPG Key ID: 0A3F5E91F8364EDF
  1. 13
      libresonic-main/pom.xml
  2. 31
      libresonic-main/src/main/java/org/libresonic/player/dao/DaoHelperFactory.java
  3. 28
      libresonic-main/src/main/java/org/libresonic/player/dao/GenericDaoHelper.java
  4. 133
      libresonic-main/src/main/java/org/libresonic/player/dao/HsqlDaoHelper.java
  5. 2
      libresonic-main/src/main/java/org/libresonic/player/dao/PlayerDao.java
  6. 22
      libresonic-main/src/main/java/org/libresonic/player/dao/UserDao.java
  7. 77
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/Schema.java
  8. 88
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema25.java
  9. 112
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema26.java
  10. 57
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema27.java
  11. 113
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema28.java
  12. 58
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema29.java
  13. 58
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema30.java
  14. 55
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema31.java
  15. 96
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema32.java
  16. 50
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema33.java
  17. 56
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema34.java
  18. 154
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema35.java
  19. 51
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema36.java
  20. 80
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema37.java
  21. 57
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema38.java
  22. 49
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema40.java
  23. 67
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema43.java
  24. 79
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema45.java
  25. 89
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema46.java
  26. 263
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema47.java
  27. 72
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema49.java
  28. 66
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema50.java
  29. 62
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema51.java
  30. 87
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema52.java
  31. 83
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema53.java
  32. 54
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema61.java
  33. 48
      libresonic-main/src/main/java/org/libresonic/player/dao/schema/hsql/Schema62.java
  34. 4
      libresonic-main/src/main/java/org/libresonic/player/spring/AdditionalPropertySourceConfigurer.java
  35. 7
      libresonic-main/src/main/java/org/libresonic/player/spring/DataSourceConfigType.java
  36. 40
      libresonic-main/src/main/java/org/libresonic/player/spring/DatasourceProfileActivatorPropertySource.java
  37. 19
      libresonic-main/src/main/java/org/libresonic/player/spring/HsqlDatabase.java
  38. 74
      libresonic-main/src/main/java/org/libresonic/player/spring/SpringLiquibase.java
  39. 11
      libresonic-main/src/main/resources/liquibase/db-changelog.xml
  40. 31
      libresonic-main/src/main/resources/liquibase/legacy/legacy-changelog.xml
  41. 131
      libresonic-main/src/main/resources/liquibase/legacy/schema25.xml
  42. 163
      libresonic-main/src/main/resources/liquibase/legacy/schema26.xml
  43. 37
      libresonic-main/src/main/resources/liquibase/legacy/schema27.xml
  44. 232
      libresonic-main/src/main/resources/liquibase/legacy/schema28.xml
  45. 44
      libresonic-main/src/main/resources/liquibase/legacy/schema29.xml
  46. 44
      libresonic-main/src/main/resources/liquibase/legacy/schema30.xml
  47. 42
      libresonic-main/src/main/resources/liquibase/legacy/schema31.xml
  48. 120
      libresonic-main/src/main/resources/liquibase/legacy/schema32.xml
  49. 30
      libresonic-main/src/main/resources/liquibase/legacy/schema33.xml
  50. 42
      libresonic-main/src/main/resources/liquibase/legacy/schema34.xml
  51. 945
      libresonic-main/src/main/resources/liquibase/legacy/schema35.xml
  52. 30
      libresonic-main/src/main/resources/liquibase/legacy/schema36.xml
  53. 81
      libresonic-main/src/main/resources/liquibase/legacy/schema37.xml
  54. 40
      libresonic-main/src/main/resources/liquibase/legacy/schema38.xml
  55. 22
      libresonic-main/src/main/resources/liquibase/legacy/schema40.xml
  56. 130
      libresonic-main/src/main/resources/liquibase/legacy/schema43.xml
  57. 84
      libresonic-main/src/main/resources/liquibase/legacy/schema45.xml
  58. 94
      libresonic-main/src/main/resources/liquibase/legacy/schema46.xml
  59. 450
      libresonic-main/src/main/resources/liquibase/legacy/schema47.xml
  60. 65
      libresonic-main/src/main/resources/liquibase/legacy/schema49.xml
  61. 64
      libresonic-main/src/main/resources/liquibase/legacy/schema50.xml
  62. 54
      libresonic-main/src/main/resources/liquibase/legacy/schema51.xml
  63. 96
      libresonic-main/src/main/resources/liquibase/legacy/schema52.xml
  64. 84
      libresonic-main/src/main/resources/liquibase/legacy/schema53.xml
  65. 42
      libresonic-main/src/main/resources/liquibase/legacy/schema61.xml
  66. 30
      libresonic-main/src/main/resources/liquibase/legacy/schema62.xml
  67. 17
      libresonic-main/src/main/webapp/WEB-INF/applicationContext-db-embed.xml
  68. 12
      libresonic-main/src/main/webapp/WEB-INF/applicationContext-db-jndi.xml
  69. 18
      libresonic-main/src/main/webapp/WEB-INF/applicationContext-db-legacy.xml
  70. 44
      libresonic-main/src/main/webapp/WEB-INF/applicationContext-db.xml
  71. 11
      libresonic-main/src/main/webapp/WEB-INF/applicationContext-service.xml
  72. 43
      libresonic-main/src/test/java/org/libresonic/player/dao/DaoTestCaseBase.java
  73. 10
      libresonic-main/src/test/java/org/libresonic/player/service/SettingsServiceTestCase.java
  74. 46
      libresonic-main/src/test/resources/org/libresonic/player/service/mediaScannerServiceTestCase/applicationContext-service.xml

@ -125,6 +125,12 @@
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
@ -366,6 +372,13 @@
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
<!-- Cannot use 3.5.3/2 due to https://liquibase.jira.com/browse/CORE-2944 -->
<version>3.5.1</version>
</dependency>
</dependencies>
<profiles>

@ -1,31 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2015 (C) Sindre Mehus
*/
package org.libresonic.player.dao;
/**
* @author Sindre Mehus
* @version $Id$
*/
public class DaoHelperFactory {
public static DaoHelper create() {
return new HsqlDaoHelper();
}
}

@ -0,0 +1,28 @@
package org.libresonic.player.dao;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
public class GenericDaoHelper implements DaoHelper {
JdbcTemplate jdbcTemplate;
NamedParameterJdbcTemplate namedParameterJdbcTemplate;
public GenericDaoHelper(
JdbcTemplate jdbcTemplate, NamedParameterJdbcTemplate namedParameterJdbcTemplate
) {
this.jdbcTemplate = jdbcTemplate;
this.namedParameterJdbcTemplate = namedParameterJdbcTemplate;
}
@Override
public JdbcTemplate getJdbcTemplate() {
return jdbcTemplate;
}
@Override
public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
return namedParameterJdbcTemplate;
}
}

@ -1,133 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2015 (C) Sindre Mehus
*/
package org.libresonic.player.dao;
import java.io.File;
import javax.sql.DataSource;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.libresonic.player.dao.schema.hsql.Schema25;
import org.libresonic.player.dao.schema.hsql.Schema26;
import org.libresonic.player.dao.schema.hsql.Schema27;
import org.libresonic.player.dao.schema.hsql.Schema28;
import org.libresonic.player.dao.schema.hsql.Schema29;
import org.libresonic.player.dao.schema.hsql.Schema30;
import org.libresonic.player.dao.schema.hsql.Schema31;
import org.libresonic.player.dao.schema.hsql.Schema32;
import org.libresonic.player.dao.schema.hsql.Schema33;
import org.libresonic.player.dao.schema.hsql.Schema34;
import org.libresonic.player.dao.schema.hsql.Schema35;
import org.libresonic.player.dao.schema.hsql.Schema36;
import org.libresonic.player.dao.schema.hsql.Schema37;
import org.libresonic.player.dao.schema.hsql.Schema38;
import org.libresonic.player.dao.schema.hsql.Schema40;
import org.libresonic.player.dao.schema.hsql.Schema43;
import org.libresonic.player.dao.schema.hsql.Schema45;
import org.libresonic.player.dao.schema.hsql.Schema46;
import org.libresonic.player.dao.schema.hsql.Schema47;
import org.libresonic.player.dao.schema.hsql.Schema49;
import org.libresonic.player.dao.schema.hsql.Schema50;
import org.libresonic.player.dao.schema.hsql.Schema51;
import org.libresonic.player.dao.schema.hsql.Schema52;
import org.libresonic.player.dao.schema.hsql.Schema53;
import org.libresonic.player.dao.schema.hsql.Schema61;
import org.libresonic.player.dao.schema.hsql.Schema62;
import org.libresonic.player.service.SettingsService;
/**
* DAO helper class which creates the data source, and updates the database schema.
*
* @author Sindre Mehus
*/
public class HsqlDaoHelper implements DaoHelper {
private static final Logger LOG = Logger.getLogger(HsqlDaoHelper.class);
private Schema[] schemas = {new Schema25(), new Schema26(), new Schema27(), new Schema28(), new Schema29(),
new Schema30(), new Schema31(), new Schema32(), new Schema33(), new Schema34(),
new Schema35(), new Schema36(), new Schema37(), new Schema38(), new Schema40(),
new Schema43(), new Schema45(), new Schema46(), new Schema47(), new Schema49(),
new Schema50(), new Schema51(), new Schema52(), new Schema53(), new Schema61(),
new Schema62()};
private DataSource dataSource;
private static boolean shutdownHookAdded;
public HsqlDaoHelper() {
dataSource = createDataSource();
checkDatabase();
addShutdownHook();
}
private void addShutdownHook() {
if (shutdownHookAdded) {
return;
}
shutdownHookAdded = true;
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
System.err.println("Shutting down database...");
getJdbcTemplate().execute("shutdown");
System.err.println("Shutting down database - Done!");
}
});
}
/**
* Returns a JDBC template for performing database operations.
*
* @return A JDBC template.
*/
public JdbcTemplate getJdbcTemplate() {
return new JdbcTemplate(dataSource);
}
public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
return new NamedParameterJdbcTemplate(dataSource);
}
private DataSource createDataSource() {
File libresonicHome = SettingsService.getLibresonicHome();
DriverManagerDataSource ds = new DriverManagerDataSource();
ds.setDriverClassName("org.hsqldb.jdbcDriver");
ds.setUrl("jdbc:hsqldb:file:" + libresonicHome.getPath() + "/db/libresonic");
ds.setUsername("sa");
ds.setPassword("");
return ds;
}
private void checkDatabase() {
LOG.info("Checking database schema.");
try {
for (Schema schema : schemas) {
schema.execute(getJdbcTemplate());
}
LOG.info("Done checking database schema.");
} catch (Exception x) {
LOG.error("Failed to initialize database.", x);
}
}
}

@ -153,7 +153,7 @@ public class PlayerDao extends AbstractDao {
update(sql, player.getName(), player.getType(), player.getUsername(),
player.getIpAddress(), player.isAutoControlEnabled(), player.isM3uBomEnabled(),
player.getLastSeen(), player.getTranscodeScheme().name(), player.isDynamicIp(),
player.getTechnology(), player.getClientId(), player.getId());
player.getTechnology().name(), player.getClientId(), player.getId());
}
private void addPlaylist(Player player) {

@ -61,6 +61,8 @@ public class UserDao extends AbstractDao {
private UserRowMapper userRowMapper = new UserRowMapper();
private UserSettingsRowMapper userSettingsRowMapper = new UserSettingsRowMapper();
String userTableQuote = "";
/**
* Returns the user with the given username.
*
@ -68,7 +70,7 @@ public class UserDao extends AbstractDao {
* @return The user, or <code>null</code> if not found.
*/
public User getUserByName(String username) {
String sql = "select " + USER_COLUMNS + " from user where username=?";
String sql = "select " + USER_COLUMNS + " from " + getUserTable() + " where username=?";
return queryOne(sql, userRowMapper, username);
}
@ -79,7 +81,7 @@ public class UserDao extends AbstractDao {
* @return The user, or <code>null</code> if not found.
*/
public User getUserByEmail(String email) {
String sql = "select " + USER_COLUMNS + " from user where email=?";
String sql = "select " + USER_COLUMNS + " from " + getUserTable() + " where email=?";
return queryOne(sql, userRowMapper, email);
}
@ -89,7 +91,7 @@ public class UserDao extends AbstractDao {
* @return Possibly empty array of all users.
*/
public List<User> getAllUsers() {
String sql = "select " + USER_COLUMNS + " from user";
String sql = "select " + USER_COLUMNS + " from " + getUserTable();
return query(sql, userRowMapper);
}
@ -99,7 +101,7 @@ public class UserDao extends AbstractDao {
* @param user The user to create.
*/
public void createUser(User user) {
String sql = "insert into user (" + USER_COLUMNS + ") values (" + questionMarks(USER_COLUMNS) + ')';
String sql = "insert into " + getUserTable() + " (" + USER_COLUMNS + ") values (" + questionMarks(USER_COLUMNS) + ')';
update(sql, user.getUsername(), encrypt(user.getPassword()), user.getEmail(), user.isLdapAuthenticated(),
user.getBytesStreamed(), user.getBytesDownloaded(), user.getBytesUploaded());
writeRoles(user);
@ -117,7 +119,7 @@ public class UserDao extends AbstractDao {
update("delete from user_role where username=?", username);
update("delete from player where username=?", username);
update("delete from user where username=?", username);
update("delete from " + getUserTable() + " where username=?", username);
}
/**
@ -126,7 +128,7 @@ public class UserDao extends AbstractDao {
* @param user The user to update.
*/
public void updateUser(User user) {
String sql = "update user set password=?, email=?, ldap_authenticated=?, bytes_streamed=?, bytes_downloaded=?, bytes_uploaded=? " +
String sql = "update " + getUserTable() + " set password=?, email=?, ldap_authenticated=?, bytes_streamed=?, bytes_downloaded=?, bytes_uploaded=? " +
"where username=?";
getJdbcTemplate().update(sql, new Object[]{encrypt(user.getPassword()), user.getEmail(), user.isLdapAuthenticated(),
user.getBytesStreamed(), user.getBytesDownloaded(), user.getBytesUploaded(),
@ -355,4 +357,12 @@ public class UserDao extends AbstractDao {
return settings;
}
}
private String getUserTable() {
return userTableQuote + "user" + userTableQuote;
}
public void setUserTableQuote(String userTableQuote) {
this.userTableQuote = userTableQuote;
}
}

@ -1,77 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema;
import org.springframework.jdbc.core.*;
/**
* Used for creating and evolving the database schema.
*
* @author Sindre Mehus
*/
public abstract class Schema {
/**
* Executes this schema.
* @param template The JDBC template to use.
*/
public abstract void execute(JdbcTemplate template);
/**
* Returns whether the given table exists.
* @param template The JDBC template to use.
* @param table The table in question.
* @return Whether the table exists.
*/
protected boolean tableExists(JdbcTemplate template, String table) {
try {
template.execute("select 1 from " + table);
} catch (Exception x) {
return false;
}
return true;
}
/**
* Returns whether the given column in the given table exists.
* @param template The JDBC template to use.
* @param column The column in question.
* @param table The table in question.
* @return Whether the column exists.
*/
protected boolean columnExists(JdbcTemplate template, String column, String table) {
try {
template.execute("select " + column + " from " + table + " where 1 = 0");
} catch (Exception x) {
return false;
}
return true;
}
protected boolean rowExists(JdbcTemplate template, String whereClause, String table) {
try {
int rowCount = template.queryForObject("select count(*) from " + table + " where " + whereClause,Integer.class);
return rowCount > 0;
} catch (Exception x) {
return false;
}
}
}

@ -1,88 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 2.5.
*
* @author Sindre Mehus
*/
public class Schema25 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema25.class);
public void execute(JdbcTemplate template) {
if (!tableExists(template, "version")) {
// Increase data file limit. See http://www.hsqldb.org/doc/guide/ch04.html
template.execute("set property \"hsqldb.cache_file_scale\" 8");
LOG.info("Database table 'version' not found. Creating it.");
template.execute("create table version (version int not null)");
template.execute("insert into version values (1)");
LOG.info("Database table 'version' was created successfully.");
}
if (!tableExists(template, "role")) {
LOG.info("Database table 'role' not found. Creating it.");
template.execute("create table role (" +
"id int not null," +
"name varchar not null," +
"primary key (id))");
template.execute("insert into role values (1, 'admin')");
template.execute("insert into role values (2, 'download')");
template.execute("insert into role values (3, 'upload')");
template.execute("insert into role values (4, 'playlist')");
template.execute("insert into role values (5, 'coverart')");
LOG.info("Database table 'role' was created successfully.");
}
if (!tableExists(template, "user")) {
LOG.info("Database table 'user' not found. Creating it.");
template.execute("create table user (" +
"username varchar not null," +
"password varchar not null," +
"primary key (username))");
template.execute("insert into user values ('admin', 'admin')");
LOG.info("Database table 'user' was created successfully.");
}
if (!tableExists(template, "user_role")) {
LOG.info("Database table 'user_role' not found. Creating it.");
template.execute("create table user_role (" +
"username varchar not null," +
"role_id int not null," +
"primary key (username, role_id)," +
"foreign key (username) references user(username)," +
"foreign key (role_id) references role(id))");
template.execute("insert into user_role values ('admin', 1)");
template.execute("insert into user_role values ('admin', 2)");
template.execute("insert into user_role values ('admin', 3)");
template.execute("insert into user_role values ('admin', 4)");
template.execute("insert into user_role values ('admin', 5)");
LOG.info("Database table 'user_role' was created successfully.");
}
}
}

@ -1,112 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.*;
import org.libresonic.player.dao.schema.Schema;
import org.libresonic.player.util.Util;
import org.springframework.jdbc.core.*;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 2.6.
*
* @author Sindre Mehus
*/
public class Schema26 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema26.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 2",Integer.class) == 0) {
LOG.info("Updating database schema to version 2.");
template.execute("insert into version values (2)");
}
if (!tableExists(template, "music_folder")) {
LOG.info("Database table 'music_folder' not found. Creating it.");
template.execute("create table music_folder (" +
"id identity," +
"path varchar not null," +
"name varchar not null," +
"enabled boolean not null)");
template.execute("insert into music_folder values (null, '" + Util.getDefaultMusicFolder() + "', 'Music', true)");
LOG.info("Database table 'music_folder' was created successfully.");
}
if (!tableExists(template, "music_file_info")) {
LOG.info("Database table 'music_file_info' not found. Creating it.");
template.execute("create cached table music_file_info (" +
"id identity," +
"path varchar not null," +
"rating int," +
"comment varchar," +
"play_count int," +
"last_played datetime)");
template.execute("create index idx_music_file_info_path on music_file_info(path)");
LOG.info("Database table 'music_file_info' was created successfully.");
}
if (!tableExists(template, "internet_radio")) {
LOG.info("Database table 'internet_radio' not found. Creating it.");
template.execute("create table internet_radio (" +
"id identity," +
"name varchar not null," +
"stream_url varchar not null," +
"homepage_url varchar," +
"enabled boolean not null)");
LOG.info("Database table 'internet_radio' was created successfully.");
}
if (!tableExists(template, "player")) {
LOG.info("Database table 'player' not found. Creating it.");
template.execute("create table player (" +
"id int not null," +
"name varchar," +
"type varchar," +
"username varchar," +
"ip_address varchar," +
"auto_control_enabled boolean not null," +
"last_seen datetime," +
"cover_art_scheme varchar not null," +
"transcode_scheme varchar not null," +
"primary key (id))");
LOG.info("Database table 'player' was created successfully.");
}
// 'dynamic_ip' was added in 2.6.beta2
if (!columnExists(template, "dynamic_ip", "player")) {
LOG.info("Database column 'player.dynamic_ip' not found. Creating it.");
template.execute("alter table player " +
"add dynamic_ip boolean default true not null");
LOG.info("Database column 'player.dynamic_ip' was added successfully.");
}
if (template.queryForObject("select count(*) from role where id = 6",Integer.class) == 0) {
LOG.info("Role 'comment' not found in database. Creating it.");
template.execute("insert into role values (6, 'comment')");
template.execute("insert into user_role " +
"select distinct u.username, 6 from user u, user_role ur " +
"where u.username = ur.username and ur.role_id in (1, 5)");
LOG.info("Role 'comment' was created successfully.");
}
}
}

@ -1,57 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.*;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.*;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 2.7.
*
* @author Sindre Mehus
*/
public class Schema27 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema27.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 3",Integer.class) == 0) {
LOG.info("Updating database schema to version 3.");
template.execute("insert into version values (3)");
LOG.info("Converting database column 'music_file_info.path' to varchar_ignorecase.");
template.execute("drop index idx_music_file_info_path");
template.execute("alter table music_file_info alter column path varchar_ignorecase not null");
template.execute("create index idx_music_file_info_path on music_file_info(path)");
LOG.info("Database column 'music_file_info.path' was converted successfully.");
}
if (!columnExists(template, "bytes_streamed", "user")) {
LOG.info("Database columns 'user.bytes_streamed/downloaded/uploaded' not found. Creating them.");
template.execute("alter table user add bytes_streamed bigint default 0 not null");
template.execute("alter table user add bytes_downloaded bigint default 0 not null");
template.execute("alter table user add bytes_uploaded bigint default 0 not null");
LOG.info("Database columns 'user.bytes_streamed/downloaded/uploaded' were added successfully.");
}
}
}

@ -1,113 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.*;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.*;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 2.8.
*
* @author Sindre Mehus
*/
public class Schema28 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema28.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 4",Integer.class) == 0) {
LOG.info("Updating database schema to version 4.");
template.execute("insert into version values (4)");
}
if (!tableExists(template, "user_settings")) {
LOG.info("Database table 'user_settings' not found. Creating it.");
template.execute("create table user_settings (" +
"username varchar not null," +
"locale varchar," +
"theme_id varchar," +
"final_version_notification boolean default true not null," +
"beta_version_notification boolean default false not null," +
"main_caption_cutoff int default 35 not null," +
"main_track_number boolean default true not null," +
"main_artist boolean default true not null," +
"main_album boolean default false not null," +
"main_genre boolean default false not null," +
"main_year boolean default false not null," +
"main_bit_rate boolean default false not null," +
"main_duration boolean default true not null," +
"main_format boolean default false not null," +
"main_file_size boolean default false not null," +
"playlist_caption_cutoff int default 35 not null," +
"playlist_track_number boolean default false not null," +
"playlist_artist boolean default true not null," +
"playlist_album boolean default true not null," +
"playlist_genre boolean default false not null," +
"playlist_year boolean default true not null," +
"playlist_bit_rate boolean default false not null," +
"playlist_duration boolean default true not null," +
"playlist_format boolean default true not null," +
"playlist_file_size boolean default true not null," +
"primary key (username)," +
"foreign key (username) references user(username) on delete cascade)");
LOG.info("Database table 'user_settings' was created successfully.");
}
if (!tableExists(template, "transcoding")) {
LOG.info("Database table 'transcoding' not found. Creating it.");
template.execute("create table transcoding (" +
"id identity," +
"name varchar not null," +
"source_format varchar not null," +
"target_format varchar not null," +
"step1 varchar not null," +
"step2 varchar," +
"step3 varchar," +
"enabled boolean not null)");
template.execute("insert into transcoding values(null,'wav > mp3', 'wav', 'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'flac > mp3','flac','mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'ogg > mp3' ,'ogg' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'wma > mp3' ,'wma' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'m4a > mp3' ,'m4a' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,false)");
template.execute("insert into transcoding values(null,'aac > mp3' ,'aac' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,false)");
template.execute("insert into transcoding values(null,'ape > mp3' ,'ape' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'mpc > mp3' ,'mpc' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'mv > mp3' ,'mv' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
template.execute("insert into transcoding values(null,'shn > mp3' ,'shn' ,'mp3','ffmpeg -i %s -v 0 -f wav -','lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -',null,true)");
LOG.info("Database table 'transcoding' was created successfully.");
}
if (!tableExists(template, "player_transcoding")) {
LOG.info("Database table 'player_transcoding' not found. Creating it.");
template.execute("create table player_transcoding (" +
"player_id int not null," +
"transcoding_id int not null," +
"primary key (player_id, transcoding_id)," +
"foreign key (player_id) references player(id) on delete cascade," +
"foreign key (transcoding_id) references transcoding(id) on delete cascade)");
LOG.info("Database table 'player_transcoding' was created successfully.");
}
}
}

@ -1,58 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.*;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.*;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 2.9.
*
* @author Sindre Mehus
*/
public class Schema29 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema29.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 5",Integer.class) == 0) {
LOG.info("Updating database schema to version 5.");
template.execute("insert into version values (5)");
}
if (!tableExists(template, "user_rating")) {
LOG.info("Database table 'user_rating' not found. Creating it.");
template.execute("create table user_rating (" +
"username varchar not null," +
"path varchar not null," +
"rating double not null," +
"primary key (username, path)," +
"foreign key (username) references user(username) on delete cascade)");
LOG.info("Database table 'user_rating' was created successfully.");
template.execute("insert into user_rating select 'admin', path, rating from music_file_info " +
"where rating is not null and rating > 0");
LOG.info("Migrated data from 'music_file_info' to 'user_rating'.");
}
}
}

@ -1,58 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.*;
import org.libresonic.player.dao.schema.Schema;
import org.libresonic.player.domain.TranscodeScheme;
import org.springframework.jdbc.core.*;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.0.
*
* @author Sindre Mehus
*/
public class Schema30 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema30.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 6", Integer.class) == 0) {
LOG.info("Updating database schema to version 6.");
template.execute("insert into version values (6)");
}
if (!columnExists(template, "last_fm_enabled", "user_settings")) {
LOG.info("Database columns 'user_settings.last_fm_*' not found. Creating them.");
template.execute("alter table user_settings add last_fm_enabled boolean default false not null");
template.execute("alter table user_settings add last_fm_username varchar null");
template.execute("alter table user_settings add last_fm_password varchar null");
LOG.info("Database columns 'user_settings.last_fm_*' were added successfully.");
}
if (!columnExists(template, "transcode_scheme", "user_settings")) {
LOG.info("Database column 'user_settings.transcode_scheme' not found. Creating it.");
template.execute("alter table user_settings add transcode_scheme varchar default '" +
TranscodeScheme.OFF.name() + "' not null");
LOG.info("Database column 'user_settings.transcode_scheme' was added successfully.");
}
}
}

@ -1,55 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.1.
*
* @author Sindre Mehus
*/
public class Schema31 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema31.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 7",Integer.class) == 0) {
LOG.info("Updating database schema to version 7.");
template.execute("insert into version values (7)");
}
if (!columnExists(template, "enabled", "music_file_info")) {
LOG.info("Database column 'music_file_info.enabled' not found. Creating it.");
template.execute("alter table music_file_info add enabled boolean default true not null");
LOG.info("Database column 'music_file_info.enabled' was added successfully.");
}
if (!columnExists(template, "default_active", "transcoding")) {
LOG.info("Database column 'transcoding.default_active' not found. Creating it.");
template.execute("alter table transcoding add default_active boolean default true not null");
LOG.info("Database column 'transcoding.default_active' was added successfully.");
}
}
}

@ -1,96 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.2.
*
* @author Sindre Mehus
*/
public class Schema32 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema32.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 8",Integer.class) == 0) {
LOG.info("Updating database schema to version 8.");
template.execute("insert into version values (8)");
}
if (!columnExists(template, "show_now_playing", "user_settings")) {
LOG.info("Database column 'user_settings.show_now_playing' not found. Creating it.");
template.execute("alter table user_settings add show_now_playing boolean default true not null");
LOG.info("Database column 'user_settings.show_now_playing' was added successfully.");
}
if (!columnExists(template, "selected_music_folder_id", "user_settings")) {
LOG.info("Database column 'user_settings.selected_music_folder_id' not found. Creating it.");
template.execute("alter table user_settings add selected_music_folder_id int default -1 not null");
LOG.info("Database column 'user_settings.selected_music_folder_id' was added successfully.");
}
if (!tableExists(template, "podcast_channel")) {
LOG.info("Database table 'podcast_channel' not found. Creating it.");
template.execute("create table podcast_channel (" +
"id identity," +
"url varchar not null," +
"title varchar," +
"description varchar," +
"status varchar not null," +
"error_message varchar)");
LOG.info("Database table 'podcast_channel' was created successfully.");
}
if (!tableExists(template, "podcast_episode")) {
LOG.info("Database table 'podcast_episode' not found. Creating it.");
template.execute("create table podcast_episode (" +
"id identity," +
"channel_id int not null," +
"url varchar not null," +
"path varchar," +
"title varchar," +
"description varchar," +
"publish_date datetime," +
"duration varchar," +
"bytes_total bigint," +
"bytes_downloaded bigint," +
"status varchar not null," +
"error_message varchar," +
"foreign key (channel_id) references podcast_channel(id) on delete cascade)");
LOG.info("Database table 'podcast_episode' was created successfully.");
}
if (template.queryForObject("select count(*) from role where id = 7",Integer.class) == 0) {
LOG.info("Role 'podcast' not found in database. Creating it.");
template.execute("insert into role values (7, 'podcast')");
template.execute("insert into user_role " +
"select distinct u.username, 7 from user u, user_role ur " +
"where u.username = ur.username and ur.role_id = 1");
LOG.info("Role 'podcast' was created successfully.");
}
}
}

@ -1,50 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.3.
*
* @author Sindre Mehus
*/
public class Schema33 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema33.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 9",Integer.class) == 0) {
LOG.info("Updating database schema to version 9.");
template.execute("insert into version values (9)");
}
if (!columnExists(template, "client_side_playlist", "player")) {
LOG.info("Database column 'player.client_side_playlist' not found. Creating it.");
template.execute("alter table player add client_side_playlist boolean default false not null");
LOG.info("Database column 'player.client_side_playlist' was added successfully.");
}
}
}

@ -1,56 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.4.
*
* @author Sindre Mehus
*/
public class Schema34 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema34.class);
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 10",Integer.class) == 0) {
LOG.info("Updating database schema to version 10.");
template.execute("insert into version values (10)");
}
if (!columnExists(template, "ldap_authenticated", "user")) {
LOG.info("Database column 'user.ldap_authenticated' not found. Creating it.");
template.execute("alter table user add ldap_authenticated boolean default false not null");
LOG.info("Database column 'user.ldap_authenticated' was added successfully.");
}
if (!columnExists(template, "party_mode_enabled", "user_settings")) {
LOG.info("Database column 'user_settings.party_mode_enabled' not found. Creating it.");
template.execute("alter table user_settings add party_mode_enabled boolean default false not null");
LOG.info("Database column 'user_settings.party_mode_enabled' was added successfully.");
}
}
}

@ -1,154 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.apache.commons.io.IOUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.5.
*
* @author Sindre Mehus
*/
public class Schema35 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema35.class);
private static final String[] AVATARS = {
"Formal", "Engineer", "Footballer", "Green-Boy",
"Linux-Zealot", "Mac-Zealot", "Windows-Zealot", "Army-Officer", "Beatnik",
"All-Caps", "Clown", "Commie-Pinko", "Forum-Flirt", "Gamer", "Hopelessly-Addicted",
"Jekyll-And-Hyde", "Joker", "Lurker", "Moderator", "Newbie", "No-Dissent",
"Performer", "Push-My-Button", "Ray-Of-Sunshine", "Red-Hot-Chili-Peppers-1",
"Red-Hot-Chili-Peppers-2", "Red-Hot-Chili-Peppers-3", "Red-Hot-Chili-Peppers-4",
"Ringmaster", "Rumor-Junkie", "Sozzled-Surfer", "Statistician", "Tech-Support",
"The-Guru", "The-Referee", "Troll", "Uptight",
"Fire-Guitar", "Drum", "Headphones", "Mic", "Turntable", "Vinyl",
"Cool", "Laugh", "Study"
};
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 11",Integer.class) == 0) {
LOG.info("Updating database schema to version 11.");
template.execute("insert into version values (11)");
}
if (!columnExists(template, "now_playing_allowed", "user_settings")) {
LOG.info("Database column 'user_settings.now_playing_allowed' not found. Creating it.");
template.execute("alter table user_settings add now_playing_allowed boolean default true not null");
LOG.info("Database column 'user_settings.now_playing_allowed' was added successfully.");
}
if (!columnExists(template, "web_player_default", "user_settings")) {
LOG.info("Database column 'user_settings.web_player_default' not found. Creating it.");
template.execute("alter table user_settings add web_player_default boolean default false not null");
LOG.info("Database column 'user_settings.web_player_default' was added successfully.");
}
if (template.queryForObject("select count(*) from role where id = 8",Integer.class) == 0) {
LOG.info("Role 'stream' not found in database. Creating it.");
template.execute("insert into role values (8, 'stream')");
template.execute("insert into user_role select distinct u.username, 8 from user u");
LOG.info("Role 'stream' was created successfully.");
}
if (!tableExists(template, "system_avatar")) {
LOG.info("Database table 'system_avatar' not found. Creating it.");
template.execute("create table system_avatar (" +
"id identity," +
"name varchar," +
"created_date datetime not null," +
"mime_type varchar not null," +
"width int not null," +
"height int not null," +
"data binary not null)");
LOG.info("Database table 'system_avatar' was created successfully.");
}
for (String avatar : AVATARS) {
createAvatar(template, avatar);
}
if (!tableExists(template, "custom_avatar")) {
LOG.info("Database table 'custom_avatar' not found. Creating it.");
template.execute("create table custom_avatar (" +
"id identity," +
"name varchar," +
"created_date datetime not null," +
"mime_type varchar not null," +
"width int not null," +
"height int not null," +
"data binary not null," +
"username varchar not null," +
"foreign key (username) references user(username) on delete cascade)");
LOG.info("Database table 'custom_avatar' was created successfully.");
}
if (!columnExists(template, "avatar_scheme", "user_settings")) {
LOG.info("Database column 'user_settings.avatar_scheme' not found. Creating it.");
template.execute("alter table user_settings add avatar_scheme varchar default 'NONE' not null");
LOG.info("Database column 'user_settings.avatar_scheme' was added successfully.");
}
if (!columnExists(template, "system_avatar_id", "user_settings")) {
LOG.info("Database column 'user_settings.system_avatar_id' not found. Creating it.");
template.execute("alter table user_settings add system_avatar_id int");
template.execute("alter table user_settings add foreign key (system_avatar_id) references system_avatar(id)");
LOG.info("Database column 'user_settings.system_avatar_id' was added successfully.");
}
if (!columnExists(template, "jukebox", "player")) {
LOG.info("Database column 'player.jukebox' not found. Creating it.");
template.execute("alter table player add jukebox boolean default false not null");
LOG.info("Database column 'player.jukebox' was added successfully.");
}
}
private void createAvatar(JdbcTemplate template, String avatar) {
if (template.queryForObject("select count(*) from system_avatar where name = ?", new Object[]{avatar},Integer.class) == 0) {
InputStream in = null;
try {
in = getClass().getResourceAsStream("/org/libresonic/player/dao/schema/" + avatar + ".png");
byte[] imageData = IOUtils.toByteArray(in);
template.update("insert into system_avatar values (null, ?, ?, ?, ?, ?, ?)",
new Object[]{avatar, new Date(), "image/png", 48, 48, imageData});
LOG.info("Created avatar '" + avatar + "'.");
} catch (IOException x) {
LOG.error("Failed to create avatar '" + avatar + "'.", x);
} finally {
IOUtils.closeQuietly(in);
}
}
}
}

@ -1,51 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implementes the database schema for Libresonic version 3.6.
*
* @author Sindre Mehus
*/
public class Schema36 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema36.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 12",Integer.class) == 0) {
LOG.info("Updating database schema to version 12.");
template.execute("insert into version values (12)");
}
if (!columnExists(template, "technology", "player")) {
LOG.info("Database column 'player.technology' not found. Creating it.");
template.execute("alter table player add technology varchar default 'WEB' not null");
LOG.info("Database column 'player.technology' was added successfully.");
}
}
}

@ -1,80 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 3.7.
*
* @author Sindre Mehus
*/
public class Schema37 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema37.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 13",Integer.class) == 0) {
LOG.info("Updating database schema to version 13.");
template.execute("insert into version values (13)");
}
if (template.queryForObject("select count(*) from role where id = 9",Integer.class) == 0) {
LOG.info("Role 'settings' not found in database. Creating it.");
template.execute("insert into role values (9, 'settings')");
template.execute("insert into user_role select distinct u.username, 9 from user u");
LOG.info("Role 'settings' was created successfully.");
}
if (template.queryForObject("select count(*) from role where id = 10",Integer.class) == 0) {
LOG.info("Role 'jukebox' not found in database. Creating it.");
template.execute("insert into role values (10, 'jukebox')");
template.execute("insert into user_role " +
"select distinct u.username, 10 from user u, user_role ur " +
"where u.username = ur.username and ur.role_id = 1");
LOG.info("Role 'jukebox' was created successfully.");
}
if (!columnExists(template, "changed", "music_folder")) {
LOG.info("Database column 'music_folder.changed' not found. Creating it.");
template.execute("alter table music_folder add changed datetime default 0 not null");
LOG.info("Database column 'music_folder.changed' was added successfully.");
}
if (!columnExists(template, "changed", "internet_radio")) {
LOG.info("Database column 'internet_radio.changed' not found. Creating it.");
template.execute("alter table internet_radio add changed datetime default 0 not null");
LOG.info("Database column 'internet_radio.changed' was added successfully.");
}
if (!columnExists(template, "changed", "user_settings")) {
LOG.info("Database column 'user_settings.changed' not found. Creating it.");
template.execute("alter table user_settings add changed datetime default 0 not null");
LOG.info("Database column 'user_settings.changed' was added successfully.");
}
}
}

@ -1,57 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 3.8.
*
* @author Sindre Mehus
*/
public class Schema38 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema38.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 14",Integer.class) == 0) {
LOG.info("Updating database schema to version 14.");
template.execute("insert into version values (14)");
}
if (!columnExists(template, "client_id", "player")) {
LOG.info("Database column 'player.client_id' not found. Creating it.");
template.execute("alter table player add client_id varchar");
LOG.info("Database column 'player.client_id' was added successfully.");
}
if (!columnExists(template, "show_chat", "user_settings")) {
LOG.info("Database column 'user_settings.show_chat' not found. Creating it.");
template.execute("alter table user_settings add show_chat boolean default true not null");
LOG.info("Database column 'user_settings.show_chat' was added successfully.");
}
}
}

@ -1,49 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 4.0.
*
* @author Sindre Mehus
*/
public class Schema40 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema40.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 15",Integer.class) == 0) {
LOG.info("Updating database schema to version 15.");
template.execute("insert into version values (15)");
// Reset stream byte count since they have been wrong in earlier releases.
template.execute("update user set bytes_streamed = 0");
LOG.info("Reset stream byte count statistics.");
}
}
}

@ -1,67 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import java.util.Arrays;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 4.3.
*
* @author Sindre Mehus
*/
public class Schema43 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema43.class);
@Override
public void execute(JdbcTemplate template) {
// version 16 was used for 4.3.beta1
if (template.queryForObject("select count(*) from version where version = 16",Integer.class) == 0) {
LOG.info("Updating database schema to version 16.");
template.execute("insert into version values (16)");
}
if (template.queryForObject("select count(*) from version where version = 17",Integer.class) == 0) {
LOG.info("Updating database schema to version 17.");
template.execute("insert into version values (17)");
for (String format : Arrays.asList("avi", "mpg", "mpeg", "mp4", "m4v", "mkv", "mov", "wmv", "ogv")) {
template.update("delete from transcoding where source_format=? and target_format=?", new Object[] {format, "flv"});
template.execute("insert into transcoding values(null,'" + format + " > flv' ,'" + format + "' ,'flv','ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -',null,null,true,true)");
template.execute("insert into player_transcoding select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = '" + format + " > flv'");
}
LOG.info("Created video transcoding configuration.");
}
if (!columnExists(template, "email", "user")) {
LOG.info("Database column 'user.email' not found. Creating it.");
template.execute("alter table user add email varchar");
LOG.info("Database column 'user.email' was added successfully.");
}
}
}

@ -1,79 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 4.5.
*
* @author Sindre Mehus
*/
public class Schema45 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema45.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 18",Integer.class) == 0) {
LOG.info("Updating database schema to version 18.");
template.execute("insert into version values (18)");
}
if (template.queryForObject("select count(*) from role where id = 11",Integer.class) == 0) {
LOG.info("Role 'share' not found in database. Creating it.");
template.execute("insert into role values (11, 'share')");
template.execute("insert into user_role " +
"select distinct u.username, 11 from user u, user_role ur " +
"where u.username = ur.username and ur.role_id = 1");
LOG.info("Role 'share' was created successfully.");
}
if (!tableExists(template, "share")) {
LOG.info("Table 'share' not found in database. Creating it.");
template.execute("create cached table share (" +
"id identity," +
"name varchar not null," +
"description varchar," +
"username varchar not null," +
"created datetime not null," +
"expires datetime," +
"last_visited datetime," +
"visit_count int default 0 not null," +
"unique (name)," +
"foreign key (username) references user(username) on delete cascade)");
template.execute("create index idx_share_name on share(name)");
LOG.info("Table 'share' was created successfully.");
LOG.info("Table 'share_file' not found in database. Creating it.");
template.execute("create cached table share_file (" +
"id identity," +
"share_id int not null," +
"path varchar not null," +
"foreign key (share_id) references share(id) on delete cascade)");
LOG.info("Table 'share_file' was created successfully.");
}
}
}

@ -1,89 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 4.6.
*
* @author Sindre Mehus
*/
public class Schema46 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema46.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 19",Integer.class) == 0) {
LOG.info("Updating database schema to version 19.");
template.execute("insert into version values (19)");
}
if (!tableExists(template, "transcoding2")) {
LOG.info("Database table 'transcoding2' not found. Creating it.");
template.execute("create table transcoding2 (" +
"id identity," +
"name varchar not null," +
"source_formats varchar not null," +
"target_format varchar not null," +
"step1 varchar not null," +
"step2 varchar," +
"step3 varchar)");
template.execute("insert into transcoding2(name, source_formats, target_format, step1) values('mp3 audio'," +
"'ogg oga aac m4a flac wav wma aif aiff ape mpc shn', 'mp3', " +
"'ffmpeg -i %s -ab %bk -v 0 -f mp3 -')");
template.execute("insert into transcoding2(name, source_formats, target_format, step1) values('flv/h264 video', " +
"'avi mpg mpeg mp4 m4v mkv mov wmv ogv divx m2ts', 'flv', " +
"'ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -vcodec libx264 -preset superfast -threads 0 -')");
LOG.info("Database table 'transcoding2' was created successfully.");
}
if (!tableExists(template, "player_transcoding2")) {
LOG.info("Database table 'player_transcoding2' not found. Creating it.");
template.execute("create table player_transcoding2 (" +
"player_id int not null," +
"transcoding_id int not null," +
"primary key (player_id, transcoding_id)," +
"foreign key (player_id) references player(id) on delete cascade," +
"foreign key (transcoding_id) references transcoding2(id) on delete cascade)");
template.execute("insert into player_transcoding2(player_id, transcoding_id) " +
"select distinct p.id, t.id from player p, transcoding2 t");
LOG.info("Database table 'player_transcoding2' was created successfully.");
}
if (!columnExists(template, "default_active", "transcoding2")) {
LOG.info("Database column 'transcoding2.default_active' not found. Creating it.");
template.execute("alter table transcoding2 add default_active boolean default true not null");
LOG.info("Database column 'transcoding2.default_active' was added successfully.");
}
}
}

@ -1,263 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.springframework.jdbc.core.JdbcTemplate;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 4.7.
*
* @author Sindre Mehus
*/
public class Schema47 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema47.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 20",Integer.class) == 0) {
LOG.info("Updating database schema to version 20.");
template.execute("insert into version values (20)");
}
if (!tableExists(template, "media_file")) {
LOG.info("Database table 'media_file' not found. Creating it.");
template.execute("create cached table media_file (" +
"id identity," +
"path varchar not null," +
"folder varchar," +
"type varchar not null," +
"format varchar," +
"title varchar," +
"album varchar," +
"artist varchar," +
"album_artist varchar," +
"disc_number int," +
"track_number int," +
"year int," +
"genre varchar," +
"bit_rate int," +
"variable_bit_rate boolean not null," +
"duration_seconds int," +
"file_size bigint," +
"width int," +
"height int," +
"cover_art_path varchar," +
"parent_path varchar," +
"play_count int not null," +
"last_played datetime," +
"comment varchar," +
"created datetime not null," +
"changed datetime not null," +
"last_scanned datetime not null," +
"children_last_updated datetime not null," +
"present boolean not null," +
"version int not null," +
"unique (path))");
template.execute("create index idx_media_file_path on media_file(path)");
template.execute("create index idx_media_file_parent_path on media_file(parent_path)");
template.execute("create index idx_media_file_type on media_file(type)");
template.execute("create index idx_media_file_album on media_file(album)");
template.execute("create index idx_media_file_artist on media_file(artist)");
template.execute("create index idx_media_file_album_artist on media_file(album_artist)");
template.execute("create index idx_media_file_present on media_file(present)");
template.execute("create index idx_media_file_genre on media_file(genre)");
template.execute("create index idx_media_file_play_count on media_file(play_count)");
template.execute("create index idx_media_file_created on media_file(created)");
template.execute("create index idx_media_file_last_played on media_file(last_played)");
LOG.info("Database table 'media_file' was created successfully.");
}
if (!tableExists(template, "artist")) {
LOG.info("Database table 'artist' not found. Creating it.");
template.execute("create cached table artist (" +
"id identity," +
"name varchar not null," +
"cover_art_path varchar," +
"album_count int default 0 not null," +
"last_scanned datetime not null," +
"present boolean not null," +
"unique (name))");
template.execute("create index idx_artist_name on artist(name)");
template.execute("create index idx_artist_present on artist(present)");
LOG.info("Database table 'artist' was created successfully.");
}
if (!tableExists(template, "album")) {
LOG.info("Database table 'album' not found. Creating it.");
template.execute("create cached table album (" +
"id identity," +
"path varchar not null," +
"name varchar not null," +
"artist varchar not null," +
"song_count int default 0 not null," +
"duration_seconds int default 0 not null," +
"cover_art_path varchar," +
"play_count int default 0 not null," +
"last_played datetime," +
"comment varchar," +
"created datetime not null," +
"last_scanned datetime not null," +
"present boolean not null," +
"unique (artist, name))");
template.execute("create index idx_album_artist_name on album(artist, name)");
template.execute("create index idx_album_play_count on album(play_count)");
template.execute("create index idx_album_last_played on album(last_played)");
template.execute("create index idx_album_present on album(present)");
LOG.info("Database table 'album' was created successfully.");
}
// Added in 4.7.beta3
if (!rowExists(template, "table_name='ALBUM' and column_name='NAME' and ordinal_position=1",
"information_schema.system_indexinfo")) {
template.execute("create index idx_album_name on album(name)");
}
if (!tableExists(template, "starred_media_file")) {
LOG.info("Database table 'starred_media_file' not found. Creating it.");
template.execute("create table starred_media_file (" +
"id identity," +
"media_file_id int not null," +
"username varchar not null," +
"created datetime not null," +
"foreign key (media_file_id) references media_file(id) on delete cascade,"+
"foreign key (username) references user(username) on delete cascade," +
"unique (media_file_id, username))");
template.execute("create index idx_starred_media_file_media_file_id on starred_media_file(media_file_id)");
template.execute("create index idx_starred_media_file_username on starred_media_file(username)");
LOG.info("Database table 'starred_media_file' was created successfully.");
}
if (!tableExists(template, "starred_album")) {
LOG.info("Database table 'starred_album' not found. Creating it.");
template.execute("create table starred_album (" +
"id identity," +
"album_id int not null," +
"username varchar not null," +
"created datetime not null," +
"foreign key (album_id) references album(id) on delete cascade," +
"foreign key (username) references user(username) on delete cascade," +
"unique (album_id, username))");
template.execute("create index idx_starred_album_album_id on starred_album(album_id)");
template.execute("create index idx_starred_album_username on starred_album(username)");
LOG.info("Database table 'starred_album' was created successfully.");
}
if (!tableExists(template, "starred_artist")) {
LOG.info("Database table 'starred_artist' not found. Creating it.");
template.execute("create table starred_artist (" +
"id identity," +
"artist_id int not null," +
"username varchar not null," +
"created datetime not null," +
"foreign key (artist_id) references artist(id) on delete cascade,"+
"foreign key (username) references user(username) on delete cascade," +
"unique (artist_id, username))");
template.execute("create index idx_starred_artist_artist_id on starred_artist(artist_id)");
template.execute("create index idx_starred_artist_username on starred_artist(username)");
LOG.info("Database table 'starred_artist' was created successfully.");
}
if (!tableExists(template, "playlist")) {
LOG.info("Database table 'playlist' not found. Creating it.");
template.execute("create table playlist (" +
"id identity," +
"username varchar not null," +
"is_public boolean not null," +
"name varchar not null," +
"comment varchar," +
"file_count int default 0 not null," +
"duration_seconds int default 0 not null," +
"created datetime not null," +
"changed datetime not null," +
"foreign key (username) references user(username) on delete cascade)");
LOG.info("Database table 'playlist' was created successfully.");
}
if (!columnExists(template, "imported_from", "playlist")) {
LOG.info("Database column 'playlist.imported_from' not found. Creating it.");
template.execute("alter table playlist add imported_from varchar");
LOG.info("Database column 'playlist.imported_from' was added successfully.");
}
if (!tableExists(template, "playlist_file")) {
LOG.info("Database table 'playlist_file' not found. Creating it.");
template.execute("create cached table playlist_file (" +
"id identity," +
"playlist_id int not null," +
"media_file_id int not null," +
"foreign key (playlist_id) references playlist(id) on delete cascade," +
"foreign key (media_file_id) references media_file(id) on delete cascade)");
LOG.info("Database table 'playlist_file' was created successfully.");
}
if (!tableExists(template, "playlist_user")) {
LOG.info("Database table 'playlist_user' not found. Creating it.");
template.execute("create table playlist_user (" +
"id identity," +
"playlist_id int not null," +
"username varchar not null," +
"unique(playlist_id, username)," +
"foreign key (playlist_id) references playlist(id) on delete cascade," +
"foreign key (username) references user(username) on delete cascade)");
LOG.info("Database table 'playlist_user' was created successfully.");
}
if (!tableExists(template, "bookmark")) {
LOG.info("Database table 'bookmark' not found. Creating it.");
template.execute("create table bookmark (" +
"id identity," +
"media_file_id int not null," +
"position_millis bigint not null," +
"username varchar not null," +
"comment varchar," +
"created datetime not null," +
"changed datetime not null," +
"foreign key (media_file_id) references media_file(id) on delete cascade,"+
"foreign key (username) references user(username) on delete cascade," +
"unique (media_file_id, username))");
template.execute("create index idx_bookmark_media_file_id on bookmark(media_file_id)");
template.execute("create index idx_bookmark_username on bookmark(username)");
LOG.info("Database table 'bookmark' was created successfully.");
}
}
}

@ -1,72 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 4.9.
*
* @author Sindre Mehus
*/
public class Schema49 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema49.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 21",Integer.class) == 0) {
LOG.info("Updating database schema to version 21.");
template.execute("insert into version values (21)");
}
if (!columnExists(template, "year", "album")) {
LOG.info("Database column 'album.year' not found. Creating it.");
template.execute("alter table album add year int");
LOG.info("Database column 'album.year' was added successfully.");
}
if (!columnExists(template, "genre", "album")) {
LOG.info("Database column 'album.genre' not found. Creating it.");
template.execute("alter table album add genre varchar");
LOG.info("Database column 'album.genre' was added successfully.");
}
if (!tableExists(template, "genre")) {
LOG.info("Database table 'genre' not found. Creating it.");
template.execute("create table genre (" +
"name varchar not null," +
"song_count int not null)");
LOG.info("Database table 'genre' was created successfully.");
}
if (!columnExists(template, "album_count", "genre")) {
LOG.info("Database column 'genre.album_count' not found. Creating it.");
template.execute("alter table genre add album_count int default 0 not null");
LOG.info("Database column 'genre.album_count' was added successfully.");
}
}
}

@ -1,66 +0,0 @@
/*
This file is part of Libresonic.
Libresonic is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Libresonic 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
Copyright 2016 (C) Libresonic Authors
Based upon Subsonic, Copyright 2009 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 5.0.
*
* @author Sindre Mehus
*/
public class Schema50 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema50.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 22",Integer.class) == 0) {
LOG.info("Updating database schema to version 22.");
template.execute("insert into version values (22)");
template.execute("insert into transcoding2(name, source_formats, target_format, step1, default_active) values('mkv video', " +
"'avi mpg mpeg mp4 m4v mkv mov wmv ogv divx m2ts', 'mkv', " +
"'ffmpeg -ss %o -i %s -c:v libx264 -preset superfast -b:v %bk -c:a libvorbis -f matroska -threads 0 -', 'true')");
template.execute("insert into player_transcoding2(player_id, transcoding_id) " +
"select distinct p.id, t.id from player p, transcoding2 t where t.name='mkv video'");
LOG.info("Added mkv transcoding.");
}
if (!columnExists(template, "song_notification", "user_settings")) {
LOG.info("Database column 'user_settings.song_notification' not found. Creating it.");
template.execute("alter table user_settings add song_notification boolean default true not null");
LOG.info("Database column 'user_settings.song_notification' was added successfully.");
}
// Added in 5.0.beta2
if (template.queryForObject("select count(*) from version where version = 23",Integer.class) == 0) {
LOG.info("Updating database schema to version 23.");
template.execute("insert into version values (23)");
template.execute("update transcoding2 set step1='ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -' where name='mp3 audio'");
}
}
}

@ -1,62 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2014 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 5.1.
*
* @author Sindre Mehus
*/
public class Schema51 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema51.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 23",Integer.class) == 0) {
LOG.info("Updating database schema to version 23.");
template.execute("insert into version values (23)");
}
if (!columnExists(template, "show_artist_info", "user_settings")) {
LOG.info("Database column 'user_settings.show_artist_info' not found. Creating it.");
template.execute("alter table user_settings add show_artist_info boolean default true not null");
LOG.info("Database column 'user_settings.show_artist_info' was added successfully.");
}
if (!columnExists(template, "auto_hide_play_queue", "user_settings")) {
LOG.info("Database column 'user_settings.auto_hide_play_queue' not found. Creating it.");
template.execute("alter table user_settings add auto_hide_play_queue boolean default true not null");
LOG.info("Database column 'user_settings.auto_hide_play_queue' was added successfully.");
}
if (!columnExists(template, "view_as_list", "user_settings")) {
LOG.info("Database column 'user_settings.view_as_list' not found. Creating it.");
template.execute("alter table user_settings add view_as_list boolean default false not null");
LOG.info("Database column 'user_settings.view_as_list' was added successfully.");
}
}
}

@ -1,87 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2015 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 5.2.
*
* @author Sindre Mehus
*/
public class Schema52 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema52.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 24",Integer.class) == 0) {
LOG.info("Updating database schema to version 24.");
template.execute("insert into version values (24)");
}
if (!tableExists(template, "music_folder_user")) {
LOG.info("Database table 'music_folder_user' not found. Creating it.");
template.execute("create table music_folder_user (" +
"music_folder_id int not null," +
"username varchar not null, " +
"foreign key (username) references user(username) on delete cascade, " +
"foreign key (music_folder_id) references music_folder(id) on delete cascade)");
template.execute("create index idx_music_folder_user_username on music_folder_user(username)");
template.execute("insert into music_folder_user select music_folder.id, user.username from music_folder, user");
LOG.info("Database table 'music_folder_user' was created successfully.");
}
if (!columnExists(template, "folder_id", "album")) {
LOG.info("Database column 'album.folder_id' not found. Creating it.");
template.execute("alter table album add folder_id int");
LOG.info("Database column 'album.folder_id' was added successfully.");
}
if (!tableExists(template, "play_queue")) {
LOG.info("Database table 'play_queue' not found. Creating it.");
template.execute("create table play_queue (" +
"id identity," +
"username varchar not null," +
"current int," +
"position_millis bigint," +
"changed datetime not null," +
"changed_by varchar not null," +
"foreign key (username) references user(username) on delete cascade)");
LOG.info("Database table 'play_queue' was created successfully.");
}
if (!tableExists(template, "play_queue_file")) {
LOG.info("Database table 'play_queue_file' not found. Creating it.");
template.execute("create cached table play_queue_file (" +
"id identity," +
"play_queue_id int not null," +
"media_file_id int not null," +
"foreign key (play_queue_id) references play_queue(id) on delete cascade," +
"foreign key (media_file_id) references media_file(id) on delete cascade)");
LOG.info("Database table 'play_queue_file' was created successfully.");
}
}
}

@ -1,83 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*
* Copyright 2015 (C) Sindre Mehus
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
import org.libresonic.player.domain.AlbumListType;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 5.3.
*
* @author Sindre Mehus
*/
public class Schema53 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema53.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 25",Integer.class) == 0) {
LOG.info("Updating database schema to version 25.");
template.execute("insert into version values (25)");
}
if (!rowExists(template, "table_name='PODCAST_EPISODE' and column_name='URL' and ordinal_position=1",
"information_schema.system_indexinfo")) {
template.execute("create index idx_podcast_episode_url on podcast_episode(url)");
LOG.info("Created index for podcast_episode.url");
}
if (!columnExists(template, "default_album_list", "user_settings")) {
LOG.info("Database column 'user_settings.default_album_list' not found. Creating it.");
template.execute("alter table user_settings add default_album_list varchar default '" +
AlbumListType.RANDOM.getId() + "' not null");
LOG.info("Database column 'user_settings.default_album_list' was added successfully.");
}
if (!columnExists(template, "queue_following_songs", "user_settings")) {
LOG.info("Database column 'user_settings.queue_following_songs' not found. Creating it.");
template.execute("alter table user_settings add queue_following_songs boolean default true not null");
LOG.info("Database column 'user_settings.queue_following_songs' was added successfully.");
}
if (!columnExists(template, "image_url", "podcast_channel")) {
LOG.info("Database column 'podcast_channel.image_url' not found. Creating it.");
template.execute("alter table podcast_channel add image_url varchar");
LOG.info("Database column 'podcast_channel.image_url' was added successfully.");
}
if (!columnExists(template, "show_side_bar", "user_settings")) {
LOG.info("Database column 'user_settings.show_side_bar' not found. Creating it.");
template.execute("alter table user_settings add show_side_bar boolean default true not null");
LOG.info("Database column 'user_settings.show_side_bar' was added successfully.");
}
if (!columnExists(template, "folder_id", "artist")) {
LOG.info("Database column 'artist.folder_id' not found. Creating it.");
template.execute("alter table artist add folder_id int");
LOG.info("Database column 'artist.folder_id' was added successfully.");
}
}
}

@ -1,54 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 6.1.
*
* @author François-Xavier Thomas
*/
public class Schema61 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema61.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 26",Integer.class) == 0) {
LOG.info("Updating database schema to version 26.");
template.execute("insert into version values (26)");
}
if (!columnExists(template, "list_reload_delay", "user_settings")) {
LOG.info("Database column 'user_settings.list_reload_delay' not found. Creating it.");
template.execute("alter table user_settings add list_reload_delay int default 60 not null");
LOG.info("Database column 'user_settings.list_reload_delay' was added successfully.");
}
if (!columnExists(template, "keyboard_shortcuts_enabled", "user_settings")) {
LOG.info("Database column 'user_settings.keyboard_shortcuts_enabled' not found. Creating it.");
template.execute("alter table user_settings add keyboard_shortcuts_enabled boolean default false not null");
LOG.info("Database column 'user_settings.keyboard_shortcuts_enabled' was added successfully.");
}
}
}

@ -1,48 +0,0 @@
/*
* This file is part of Libresonic.
*
* Libresonic is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Libresonic 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Libresonic. If not, see <http://www.gnu.org/licenses/>.
*/
package org.libresonic.player.dao.schema.hsql;
import org.springframework.jdbc.core.JdbcTemplate;
import org.libresonic.player.Logger;
import org.libresonic.player.dao.schema.Schema;
/**
* Used for creating and evolving the database schema.
* This class implements the database schema for Libresonic version 6.1.
*
* @author Shen-Ta Hsieh
*/
public class Schema62 extends Schema {
private static final Logger LOG = Logger.getLogger(Schema62.class);
@Override
public void execute(JdbcTemplate template) {
if (template.queryForObject("select count(*) from version where version = 27",Integer.class) == 0) {
LOG.info("Updating database schema to version 27.");
template.execute("insert into version values (27)");
}
if (!columnExists(template, "m3u_bom_enabled", "player")) {
LOG.info("Database column 'player.m3u_bom_enabled' not found. Creating it.");
template.execute("alter table player add m3u_bom_enabled boolean default false not null");
LOG.info("Database column 'player.m3u_bom_enabled' was added successfully.");
}
}
}

@ -14,7 +14,9 @@ public class AdditionalPropertySourceConfigurer implements
ApacheCommonsConfigurationService configurationService = new ApacheCommonsConfigurationService();
ImmutableConfiguration snapshot = configurationService.getImmutableSnapshot();
PropertySource ps = new CommonsConfigurationPropertySource("libresonic-pre-init-configs", snapshot);
PropertySource ps = new DatasourceProfileActivatorPropertySource(new CommonsConfigurationPropertySource(
"libresonic-pre-init-configs",
snapshot));
ctx.getEnvironment().getPropertySources().addLast(ps);
}
}

@ -0,0 +1,7 @@
package org.libresonic.player.spring;
public enum DataSourceConfigType {
JNDI,
EMBED,
LEGACY
}

@ -0,0 +1,40 @@
package org.libresonic.player.spring;
import org.apache.commons.lang3.StringUtils;
import org.springframework.core.env.PropertySource;
public class DatasourceProfileActivatorPropertySource extends PropertySource {
public static final String SPRING_PROFILES_ACTIVE = "spring.profiles.active";
public static final String DATASOURCE_CONFIG_TYPE = "database.config.type";
final PropertySource parent;
public DatasourceProfileActivatorPropertySource(PropertySource parent) {
super(parent.getName());
this.parent = parent;
}
@Override
public Object getProperty(String name) {
if(StringUtils.equalsIgnoreCase(name, SPRING_PROFILES_ACTIVE)) {
String appendTo = "";
Object existing = parent.getProperty(SPRING_PROFILES_ACTIVE);
if(existing != null && existing instanceof String) {
appendTo += (String) existing;
}
DataSourceConfigType dataSourceConfigType;
Object rawType = parent.getProperty(DATASOURCE_CONFIG_TYPE);
if(rawType != null && rawType instanceof String) {
dataSourceConfigType = DataSourceConfigType.valueOf(StringUtils.upperCase((String) rawType));
} else {
dataSourceConfigType = DataSourceConfigType.LEGACY;
}
if(StringUtils.isNotBlank(appendTo)) {
appendTo += ",";
}
appendTo += StringUtils.lowerCase(dataSourceConfigType.name());
return appendTo;
} else {
return parent.getProperty(name);
}
}
}

@ -0,0 +1,19 @@
package org.libresonic.player.spring;
import liquibase.exception.DatabaseException;
public class HsqlDatabase extends liquibase.database.core.HsqlDatabase {
@Override
public boolean supportsSchemas() {
try {
if(getDatabaseMajorVersion() < 2) {
return false;
} else {
return super.supportsSchemas();
}
} catch (DatabaseException e) {
return false;
}
}
}

@ -0,0 +1,74 @@
package org.libresonic.player.spring;
import liquibase.database.Database;
import liquibase.database.DatabaseConnection;
import liquibase.database.DatabaseFactory;
import liquibase.database.OfflineConnection;
import liquibase.database.jvm.JdbcConnection;
import liquibase.exception.DatabaseException;
import liquibase.exception.LiquibaseException;
import liquibase.resource.ResourceAccessor;
import liquibase.util.StringUtils;
import org.libresonic.player.Logger;
import java.sql.Connection;
import java.util.Iterator;
import java.util.List;
public class SpringLiquibase extends liquibase.integration.spring.SpringLiquibase {
private static final Logger logger = Logger.getLogger(SpringLiquibase.class);
@Override
public void afterPropertiesSet() throws LiquibaseException {
try {
super.afterPropertiesSet();
} catch(Exception e) {
logger.error("===============================================");
logger.error("An exception occurred during database migration");
logger.error("A rollback file has been generated at " + rollbackFile);
logger.error("Execute it within your database to rollback any changes");
logger.error("The exception is as follows\n", e);
logger.error("===============================================");
throw(e);
}
}
@Override
protected Database createDatabase(
Connection c, ResourceAccessor resourceAccessor
) throws DatabaseException {
DatabaseConnection liquibaseConnection;
if (c == null) {
log.warning("Null connection returned by liquibase datasource. Using offline unknown database");
liquibaseConnection = new OfflineConnection("offline:unknown", resourceAccessor);
} else {
liquibaseConnection = new JdbcConnection(c);
}
DatabaseFactory factory = DatabaseFactory.getInstance();
overrideHsqlDbImplementation(factory);
Database database = factory.findCorrectDatabaseImplementation(liquibaseConnection);
if (StringUtils.trimToNull(this.defaultSchema) != null) {
database.setDefaultSchemaName(this.defaultSchema);
}
return database;
}
private void overrideHsqlDbImplementation(DatabaseFactory factory) {
List<Database> implementedDatabases = factory.getImplementedDatabases();
factory.clearRegistry();
removeCurrentHsqlDb(implementedDatabases);
implementedDatabases.forEach(factory::register);
factory.register(new HsqlDatabase());
}
private void removeCurrentHsqlDb(List<Database> implementedDatabases) {
Iterator<Database> iterator = implementedDatabases.iterator();
while(iterator.hasNext()) {
Database db = iterator.next();
if(db instanceof liquibase.database.core.HsqlDatabase) {
iterator.remove();
}
}
}
}

@ -0,0 +1,11 @@
<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.1.xsd">
<property name="binary_type" dbms="hsqldb" value="binary" />
<property name="binary_type" value="blob" />
<property name="curr_date_expr" value="current_timestamp" />
<property name="varchar_type" dbms="mysql" value="varchar(${varcharLimit})" />
<property name="varchar_type" value="varchar" />
<include file="legacy/legacy-changelog.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

@ -0,0 +1,31 @@
<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.1.xsd">
<include file="schema25.xml" relativeToChangelogFile="true"/>
<include file="schema26.xml" relativeToChangelogFile="true"/>
<include file="schema27.xml" relativeToChangelogFile="true"/>
<include file="schema28.xml" relativeToChangelogFile="true"/>
<include file="schema29.xml" relativeToChangelogFile="true"/>
<include file="schema30.xml" relativeToChangelogFile="true"/>
<include file="schema31.xml" relativeToChangelogFile="true"/>
<include file="schema32.xml" relativeToChangelogFile="true"/>
<include file="schema33.xml" relativeToChangelogFile="true"/>
<include file="schema34.xml" relativeToChangelogFile="true"/>
<include file="schema35.xml" relativeToChangelogFile="true"/>
<include file="schema36.xml" relativeToChangelogFile="true"/>
<include file="schema37.xml" relativeToChangelogFile="true"/>
<include file="schema38.xml" relativeToChangelogFile="true"/>
<include file="schema40.xml" relativeToChangelogFile="true"/>
<include file="schema43.xml" relativeToChangelogFile="true"/>
<include file="schema45.xml" relativeToChangelogFile="true"/>
<include file="schema46.xml" relativeToChangelogFile="true"/>
<include file="schema47.xml" relativeToChangelogFile="true"/>
<include file="schema49.xml" relativeToChangelogFile="true"/>
<include file="schema50.xml" relativeToChangelogFile="true"/>
<include file="schema51.xml" relativeToChangelogFile="true"/>
<include file="schema52.xml" relativeToChangelogFile="true"/>
<include file="schema53.xml" relativeToChangelogFile="true"/>
<include file="schema61.xml" relativeToChangelogFile="true"/>
<include file="schema62.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>

@ -0,0 +1,131 @@
<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.1.xsd">
<changeSet id="schema25_001" author="muff1nman" dbms="hsqldb">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="version" />
</not>
</preConditions>
<sql>set property &quot;hsqldb.cache_file_scale&quot; 8</sql>
<rollback/>
</changeSet>
<changeSet id="schema25_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="version" />
</not>
</preConditions>
<createTable tableName="version">
<column name="version" type="int">
<constraints nullable="false" />
</column>
</createTable>
<insert tableName="version" >
<column name="version" valueNumeric="1" />
</insert>
<rollback>
<dropTable tableName="version" />
</rollback>
</changeSet>
<changeSet id="schema25_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="role" />
</not>
</preConditions>
<createTable tableName="role">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
</createTable>
<insert tableName="role">
<column name="id" valueNumeric="1" />
<column name="name" value="admin"/>
</insert>
<insert tableName="role">
<column name="id" valueNumeric="2" />
<column name="name" value="download"/>
</insert>
<insert tableName="role">
<column name="id" valueNumeric="3" />
<column name="name" value="upload"/>
</insert>
<insert tableName="role">
<column name="id" valueNumeric="4" />
<column name="name" value="playlist"/>
</insert>
<insert tableName="role">
<column name="id" valueNumeric="5" />
<column name="name" value="coverart"/>
</insert>
<rollback>
<dropTable tableName="role" />
</rollback>
</changeSet>
<changeSet id="schema25_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="user" />
</not>
</preConditions>
<createTable tableName="user">
<column name="username" type="${varchar_type}">
<constraints primaryKey="true" />
</column>
<column name="password" type="${varchar_type}" >
<constraints nullable="false" />
</column>
</createTable>
<insert tableName="user">
<column name="username" value="admin"/>
<column name="password" value="admin"/>
</insert>
<rollback>
<dropTable tableName="user" />
</rollback>
</changeSet>
<changeSet id="schema25_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="user_role" />
</not>
</preConditions>
<createTable tableName="user_role">
<column name="username" type="${varchar_type}">
<constraints nullable="false" foreignKeyName="ur_u_fk" referencedTableName="user" referencedColumnNames="username"/>
</column>
<column name="role_id" type="int" >
<constraints nullable="false" foreignKeyName="ur_r_fk" referencedTableName="role" referencedColumnNames="id"/>
</column>
</createTable>
<addPrimaryKey tableName="user_role" columnNames="username,role_id" />
<insert tableName="user_role">
<column name="username" value="admin"/>
<column name="role_id" valueNumeric="1" />
</insert>
<insert tableName="user_role">
<column name="username" value="admin"/>
<column name="role_id" valueNumeric="2" />
</insert>
<insert tableName="user_role">
<column name="username" value="admin"/>
<column name="role_id" valueNumeric="3" />
</insert>
<insert tableName="user_role">
<column name="username" value="admin"/>
<column name="role_id" valueNumeric="4" />
</insert>
<insert tableName="user_role">
<column name="username" value="admin"/>
<column name="role_id" valueNumeric="5" />
</insert>
<rollback>
<dropTable tableName="user_role" />
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,163 @@
<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.1.xsd">
<changeSet id="schema26_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 2</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="2" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 2</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema26_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="music_folder" />
</not>
</preConditions>
<createTable tableName="music_folder">
<column name="id" type="int" autoIncrement="true" >
<constraints primaryKey="true" nullable="false" />
</column>
<column name="path" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="enabled" type="boolean" >
<constraints nullable="false" />
</column>
</createTable>
<insert tableName="music_folder">
<column name="path" value="${defaultMusicFolder}"/>
<column name="name" value="Music"/>
<column name="enabled" valueBoolean="true" />
</insert>
<rollback>
<dropTable tableName="music_folder" />
</rollback>
</changeSet>
<changeSet id="schema26_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="music_file_info" />
</not>
</preConditions>
<createTable tableName="music_file_info">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="path" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="rating" type="int" />
<column name="comment" type="${varchar_type}" />
<column name="play_count" type="int" />
<column name="last_played" type="datetime" />
</createTable>
<createIndex tableName="music_file_info" indexName="idx_music_file_info_path">
<column name="path"/>
</createIndex>
<rollback>
<dropTable tableName="music_file_info" />
</rollback>
</changeSet>
<changeSet id="schema26_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="internet_radio" />
</not>
</preConditions>
<createTable tableName="internet_radio">
<column name="id" type="int" autoIncrement="true" >
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="stream_url" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="homepage_url" type="${varchar_type}" />
<column name="enabled" type="boolean" >
<constraints nullable="false" />
</column>
</createTable>
<rollback>
<dropTable tableName="internet_radio" />
</rollback>
</changeSet>
<changeSet id="schema26_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="player" />
</not>
</preConditions>
<createTable tableName="player">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" />
<column name="type" type="${varchar_type}" />
<column name="username" type="${varchar_type}" />
<column name="ip_address" type="${varchar_type}" />
<column name="auto_control_enabled" type="boolean" >
<constraints nullable="false" />
</column>
<column name="last_seen" type="datetime" />
<column name="cover_art_scheme" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="transcode_scheme" type="${varchar_type}" >
<constraints nullable="false" />
</column>
</createTable>
<rollback>
<dropTable tableName="player" />
</rollback>
</changeSet>
<changeSet id="schema26_006" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="player" columnName="dynamic_ip" />
</not>
</preConditions>
<addColumn tableName="player">
<column name="dynamic_ip" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
<rollback>
<dropColumn tableName="player" columnName="dynamic_ip"/>
</rollback>
</changeSet>
<changeSet id="schema26_007" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from role where id = 6</sqlCheck>
</preConditions>
<insert tableName="role">
<column name="id" valueNumeric="6"/>
<column name="name" value="comment" />
</insert>
<sql>
insert into user_role(username, role_id)
select distinct u.username, 6 from ${userTableQuote}user${userTableQuote} u, user_role ur
where u.username = ur.username and ur.role_id in (1, 5)
</sql>
<rollback>
<delete tableName="user_role" >
<where>role_id = 6</where>
</delete>
<delete tableName="role">
<where>id = 6</where>
</delete>
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,37 @@
<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.1.xsd">
<!-- Note that music_file_info.path case insensitive change was ignored -->
<changeSet id="schema27_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 3</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="3" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 3</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema27_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user" columnName="bytes_streamed" />
</not>
</preConditions>
<addColumn tableName="user">
<column name="bytes_streamed" type="bigint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="bytes_downloaded" type="bigint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="bytes_uploaded" type="bigint" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,232 @@
<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.1.xsd">
<changeSet id="schema28_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 4</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="4" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 4</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema28_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="user_settings" />
</not>
</preConditions>
<createTable tableName="user_settings">
<column name="username" type="${varchar_type}">
<constraints primaryKey="true" foreignKeyName="us_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true"/>
</column>
<column name="locale" type="${varchar_type}" />
<column name="theme_id" type="${varchar_type}" />
<column name="final_version_notification" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="beta_version_notification" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="main_caption_cutoff" type="int" defaultValueNumeric="35" >
<constraints nullable="false" />
</column>
<column name="main_track_number" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="main_artist" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="main_album" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="main_genre" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="main_year" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="main_bit_rate" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="main_duration" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="main_format" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="main_file_size" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="playlist_caption_cutoff" type="int" defaultValueNumeric="35" >
<constraints nullable="false" />
</column>
<column name="playlist_track_number" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="playlist_artist" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="playlist_album" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="playlist_genre" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="playlist_year" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="playlist_bit_rate" type="boolean" defaultValueBoolean="false" >
<constraints nullable="false" />
</column>
<column name="playlist_duration" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="playlist_format" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
<column name="playlist_file_size" type="boolean" defaultValueBoolean="true" >
<constraints nullable="false" />
</column>
</createTable>
<rollback>
<dropTable tableName="user_settings" />
</rollback>
</changeSet>
<changeSet id="schema28_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="transcoding" />
</not>
</preConditions>
<createTable tableName="transcoding">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="source_format" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="target_format" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="step1" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="step2" type="${varchar_type}" />
<column name="step3" type="${varchar_type}" />
<column name="enabled" type="boolean" >
<constraints nullable="false" />
</column>
</createTable>
<insert tableName="transcoding">
<column name="name" value="wav > mp3"/>
<column name="source_format" value="wav" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="flac > mp3"/>
<column name="source_format" value="flac" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="ogg > mp3"/>
<column name="source_format" value="ogg" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="wma > mp3"/>
<column name="source_format" value="wma" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="m4a > mp3"/>
<column name="source_format" value="m4a" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="false" />
</insert>
<insert tableName="transcoding">
<column name="name" value="aac > mp3"/>
<column name="source_format" value="aac" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="false" />
</insert>
<insert tableName="transcoding">
<column name="name" value="ape > mp3"/>
<column name="source_format" value="ape" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="mpc > mp3"/>
<column name="source_format" value="mpc" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="mv > mp3"/>
<column name="source_format" value="mv" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<insert tableName="transcoding">
<column name="name" value="shn > mp3"/>
<column name="source_format" value="shn" />
<column name="target_format" value="mp3"/>
<column name="step1" value="ffmpeg -i %s -v 0 -f wav -" />
<column name="step2" value="lame -b %b --tt %t --ta %a --tl %l -S --resample 44.1 - -" />
<column name="enabled" valueBoolean="true" />
</insert>
<rollback>
<dropTable tableName="transcoding" />
</rollback>
</changeSet>
<changeSet id="schema28_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="player_transcoding" />
</not>
</preConditions>
<createTable tableName="player_transcoding">
<column name="player_id" type="int">
<constraints nullable="false" foreignKeyName="pt_p_fk" referencedTableName="player" referencedColumnNames="id" deleteCascade="true"/>
</column>
<column name="transcoding_id" type="int" >
<constraints nullable="false" foreignKeyName="pt_t_fk" referencedTableName="transcoding" referencedColumnNames="id" deleteCascade="true"/>
</column>
</createTable>
<addPrimaryKey tableName="player_transcoding" columnNames="player_id,transcoding_id" />
<rollback>
<dropTable tableName="player_transcoding" />
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,44 @@
<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.1.xsd">
<changeSet id="schema29_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 5</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="5" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 5</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema29_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="user_rating" />
</not>
</preConditions>
<createTable tableName="user_rating">
<column name="username" type="${varchar_type}">
<constraints nullable="false" foreignKeyName="ura_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true"/>
</column>
<column name="path" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="rating" type="double" >
<constraints nullable="false" />
</column>
</createTable>
<addPrimaryKey tableName="user_rating" columnNames="username,path" />
<sql>
insert into user_rating select 'admin', path, rating from music_file_info
where rating is not null and rating > 0
</sql>
<rollback>
<dropTable tableName="user_rating" />
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,44 @@
<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.1.xsd">
<changeSet id="schema30_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 6</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="6" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 6</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema30_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="last_fm_enabled" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="last_fm_enabled" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
<column name="last_fm_username" type="${varchar_type}" />
<column name="last_fm_password" type="${varchar_type}" />
</addColumn>
</changeSet>
<changeSet id="schema30_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="transcode_scheme" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="transcode_scheme" type="${varchar_type}" defaultValue="OFF">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,42 @@
<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.1.xsd">
<changeSet id="schema31_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 7</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="7" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 7</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema31_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="music_file_info" columnName="enabled" />
</not>
</preConditions>
<addColumn tableName="music_file_info">
<column name="enabled" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema31_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="transcoding" columnName="default_active" />
</not>
</preConditions>
<addColumn tableName="transcoding">
<column name="default_active" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,120 @@
<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.1.xsd">
<changeSet id="schema32_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 8</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="8" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 8</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema32_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="show_now_playing" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="show_now_playing" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema32_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="selected_music_folder_id" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="selected_music_folder_id" type="int" defaultValueNumeric="-1">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema32_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="podcast_channel" />
</not>
</preConditions>
<createTable tableName="podcast_channel">
<column name="id" type="int" autoIncrement="true" >
<constraints primaryKey="true" />
</column>
<column name="url" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="title" type="${varchar_type}" />
<column name="description" type="${varchar_type}" />
<column name="status" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="error_message" type="${varchar_type}" />
</createTable>
<rollback>
<dropTable tableName="podcast_channel" />
</rollback>
</changeSet>
<changeSet id="schema32_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="podcast_episode"/>
</not>
</preConditions>
<createTable tableName="podcast_episode">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="channel_id" type="int" >
<constraints nullable="false" foreignKeyName="pe_pc_fk" referencedTableName="podcast_channel" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="url" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="path" type="${varchar_type}" />
<column name="title" type="${varchar_type}" />
<column name="description" type="${varchar_type}" />
<column name="publish_date" type="datetime" />
<column name="duration" type="${varchar_type}" />
<column name="bytes_total" type="bigint" />
<column name="bytes_downloaded" type="bigint" />
<column name="status" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="error_message" type="${varchar_type}" />
</createTable>
<rollback>
<dropTable tableName="podcast_episode" />
</rollback>
</changeSet>
<changeSet id="schema32_006" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from role where id = 7</sqlCheck>
</preConditions>
<insert tableName="role">
<column name="id" valueNumeric="7"/>
<column name="name" value="podcast" />
</insert>
<sql>
insert into user_role(username, role_id)
select distinct u.username, 7 from ${userTableQuote}user${userTableQuote} u, user_role ur
where u.username = ur.username and ur.role_id = 1
</sql>
<rollback>
<delete tableName="user_role">
<where>role_id = 7</where>
</delete>
<delete tableName="role">
<where>id = 7</where>
</delete>
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,30 @@
<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.1.xsd">
<changeSet id="schema33_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 9</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="9" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 9</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema33_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="player" columnName="client_side_playlist" />
</not>
</preConditions>
<addColumn tableName="player">
<column name="client_side_playlist" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,42 @@
<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.1.xsd">
<changeSet id="schema34_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 10</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="10" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 10</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema34_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user" columnName="ldap_authenticated" />
</not>
</preConditions>
<addColumn tableName="user">
<column name="ldap_authenticated" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema34_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="party_mode_enabled" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="party_mode_enabled" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,945 @@
<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.1.xsd">
<changeSet id="schema35_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 11</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="11" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 11</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="now_playing_allowed" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="now_playing_allowed" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema35_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="web_player_default" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="web_player_default" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema35_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from role where id = 8</sqlCheck>
</preConditions>
<insert tableName="role">
<column name="id" valueNumeric="8"/>
<column name="name" value="stream" />
</insert>
<sql>
insert into user_role(username, role_id) select distinct u.username, 8 from ${userTableQuote}user${userTableQuote} u
</sql>
<rollback>
<delete tableName="user_role" >
<where>role_id = 8</where>
</delete>
<delete tableName="role">
<where>id = 8</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="system_avatar" />
</not>
</preConditions>
<createTable tableName="system_avatar">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" />
<column name="created_date" type="datetime" defaultValueComputed="${curr_date_expr}">
<constraints nullable="false" />
</column>
<column name="mime_type" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="width" type="int" >
<constraints nullable="false" />
</column>
<column name="height" type="int" >
<constraints nullable="false" />
</column>
<column name="data" type="${binary_type}" >
<constraints nullable="false" />
</column>
</createTable>
<rollback>
<dropTable tableName="system_avatar" />
</rollback>
</changeSet>
<changeSet id="schema35_006" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="custom_avatar" />
</not>
</preConditions>
<createTable tableName="custom_avatar">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}"/>
<column name="created_date" type="datetime" defaultValueComputed="${curr_date_expr}">
<constraints nullable="false" />
</column>
<column name="mime_type" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="width" type="int" >
<constraints nullable="false" />
</column>
<column name="height" type="int" >
<constraints nullable="false" />
</column>
<column name="data" type="${binary_type}" >
<constraints nullable="false" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" deleteCascade="true" foreignKeyName="ca_u_fk" referencedTableName="user" referencedColumnNames="username" />
</column>
</createTable>
<rollback>
<dropTable tableName="custom_avatar" />
</rollback>
</changeSet>
<changeSet id="schema35_007" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="avatar_scheme" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="avatar_scheme" type="${varchar_type}" defaultValue="NONE">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema35_008" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="system_avatar_id" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="system_avatar_id" type="int">
<constraints foreignKeyName="us_sai_fk" referencedTableName="system_avatar" referencedColumnNames="id" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema35_009" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="player" columnName="jukebox" />
</not>
</preConditions>
<addColumn tableName="player">
<column name="jukebox" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema35_010_Formal" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Formal'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Formal" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Formal.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Formal'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Engineer" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Engineer'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Engineer" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Engineer.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Engineer'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Footballer" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Footballer'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Footballer" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Footballer.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Footballer'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Green-Boy" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Green-Boy'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Green-Boy" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Green-Boy.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Green-Boy'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Linux-Zealot" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Linux-Zealot'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Linux-Zealot" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Linux-Zealot.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Linux-Zealot'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Mac-Zealot" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Mac-Zealot'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Mac-Zealot" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Mac-Zealot.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Mac-Zealot'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Windows-Zealot" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Windows-Zealot'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Windows-Zealot" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Windows-Zealot.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Windows-Zealot'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Army-Officer" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Army-Officer'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Army-Officer" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Army-Officer.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Army-Officer'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Beatnik" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Beatnik'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Beatnik" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Beatnik.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Beatnik'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_All-Caps" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'All-Caps'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="All-Caps" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/All-Caps.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'All-Caps'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Clown" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Clown'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Clown" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Clown.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Clown'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Commie-Pinko" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Commie-Pinko'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Commie-Pinko" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Commie-Pinko.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Commie-Pinko'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Forum-Flirt" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Forum-Flirt'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Forum-Flirt" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Forum-Flirt.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Forum-Flirt'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Gamer" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Gamer'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Gamer" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Gamer.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Gamer'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Hopelessly-Addicted" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Hopelessly-Addicted'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Hopelessly-Addicted" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Hopelessly-Addicted.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Hopelessly-Addicted'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Jekyll-And-Hyde" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Jekyll-And-Hyde'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Jekyll-And-Hyde" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Jekyll-And-Hyde.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Jekyll-And-Hyde'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Joker" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Joker'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Joker" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Joker.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Joker'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Lurker" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Lurker'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Lurker" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Lurker.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Lurker'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Moderator" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Moderator'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Moderator" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Moderator.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Moderator'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Newbie" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Newbie'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Newbie" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Newbie.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Newbie'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_No-Dissent" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'No-Dissent'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="No-Dissent" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/No-Dissent.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'No-Dissent'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Performer" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Performer'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Performer" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Performer.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Performer'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Push-My-Button" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Push-My-Button'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Push-My-Button" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Push-My-Button.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Push-My-Button'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Ray-Of-Sunshine" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Ray-Of-Sunshine'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Ray-Of-Sunshine" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Ray-Of-Sunshine.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Ray-Of-Sunshine'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Red-Hot-Chili-Peppers-1" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Red-Hot-Chili-Peppers-1'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Red-Hot-Chili-Peppers-1" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Red-Hot-Chili-Peppers-1.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Red-Hot-Chili-Peppers-1'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Red-Hot-Chili-Peppers-2" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Red-Hot-Chili-Peppers-2'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Red-Hot-Chili-Peppers-2" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Red-Hot-Chili-Peppers-2.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Red-Hot-Chili-Peppers-2'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Red-Hot-Chili-Peppers-3" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Red-Hot-Chili-Peppers-3'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Red-Hot-Chili-Peppers-3" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Red-Hot-Chili-Peppers-3.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Red-Hot-Chili-Peppers-3'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Red-Hot-Chili-Peppers-4" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Red-Hot-Chili-Peppers-4'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Red-Hot-Chili-Peppers-4" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Red-Hot-Chili-Peppers-4.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Red-Hot-Chili-Peppers-4'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Ringmaster" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Ringmaster'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Ringmaster" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Ringmaster.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Ringmaster'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Rumor-Junkie" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Rumor-Junkie'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Rumor-Junkie" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Rumor-Junkie.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Rumor-Junkie'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Sozzled-Surfer" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Sozzled-Surfer'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Sozzled-Surfer" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Sozzled-Surfer.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Sozzled-Surfer'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Statistician" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Statistician'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Statistician" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Statistician.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Statistician'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Tech-Support" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Tech-Support'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Tech-Support" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Tech-Support.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Tech-Support'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_The-Guru" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'The-Guru'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="The-Guru" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/The-Guru.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'The-Guru'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_The-Referee" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'The-Referee'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="The-Referee" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/The-Referee.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'The-Referee'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Troll" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Troll'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Troll" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Troll.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Troll'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Uptight" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Uptight'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Uptight" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Uptight.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Uptight'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Fire-Guitar" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Fire-Guitar'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Fire-Guitar" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Fire-Guitar.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Fire-Guitar'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Drum" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Drum'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Drum" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Drum.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Drum'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Headphones" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Headphones'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Headphones" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Headphones.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Headphones'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Mic" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Mic'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Mic" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Mic.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Mic'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Turntable" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Turntable'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Turntable" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Turntable.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Turntable'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Vinyl" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Vinyl'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Vinyl" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Vinyl.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Vinyl'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Cool" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Cool'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Cool" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Cool.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Cool'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Laugh" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Laugh'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Laugh" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Laugh.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Laugh'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema35_010_Study" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from system_avatar where name = 'Study'</sqlCheck>
</preConditions>
<insert tableName="system_avatar">
<column name="name" value="Study" />
<column name="mime_type" value="img/png" />
<column name="width" valueNumeric="48" />
<column name="height" valueNumeric="48" />
<column name="data" valueBlobFile="../../org/libresonic/player/dao/schema/Study.png" />
</insert>
<rollback>
<delete tableName="system_avatar">
<where>name = 'Study'</where>
</delete>
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,30 @@
<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.1.xsd">
<changeSet id="schema36_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 12</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="12" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 12</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema36_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="player" columnName="technology" />
</not>
</preConditions>
<addColumn tableName="player">
<column name="technology" type="${varchar_type}" defaultValue="WEB">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,81 @@
<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.1.xsd">
<property name="curr_date_expr" value="current_timestamp" />
<changeSet id="schema37_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 13</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="13" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 13</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema37_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from role where id = 9</sqlCheck>
</preConditions>
<insert tableName="role">
<column name="id" valueNumeric="9"/>
<column name="name" value="settings" />
</insert>
<sql>
insert into user_role(username, role_id) select distinct u.username, 9 from ${userTableQuote}user${userTableQuote} u
</sql>
<rollback />
</changeSet>
<changeSet id="schema37_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from role where id = 10</sqlCheck>
</preConditions>
<insert tableName="role">
<column name="id" valueNumeric="10"/>
<column name="name" value="jukebox" />
</insert>
<sql>
insert into user_role(username, role_id) select distinct u.username, 10 from ${userTableQuote}user${userTableQuote} u
</sql>
<rollback />
</changeSet>
<changeSet id="schema37_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="music_folder" columnName="changed" />
</not>
</preConditions>
<addColumn tableName="music_folder">
<column name="changed" type="datetime" defaultValueComputed="${curr_date_expr}">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema37_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="internet_radio" columnName="changed" />
</not>
</preConditions>
<addColumn tableName="internet_radio">
<column name="changed" type="datetime" defaultValueComputed="${curr_date_expr}">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema37_006" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="changed" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="changed" type="datetime" defaultValueComputed="${curr_date_expr}">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,40 @@
<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.1.xsd">
<changeSet id="schema38_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 14</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="14" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 14</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema38_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="player" columnName="client_id" />
</not>
</preConditions>
<addColumn tableName="player">
<column name="client_id" type="${varchar_type}"/>
</addColumn>
</changeSet>
<changeSet id="schema38_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="show_chat" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="show_chat" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,22 @@
<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.1.xsd">
<changeSet id="schema40_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 15</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="15" />
</insert>
<!--Reset stream byte count since they have been wrong in earlier releases.-->
<update tableName="user">
<column name="bytes_streamed" valueNumeric="0" />
</update>
<rollback>
<delete tableName="version" >
<where>version = 15</where>
</delete>
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,130 @@
<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.1.xsd">
<changeSet id="schema43_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 16</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="16" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 16</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema43_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 17</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="17" />
</insert>
<delete tableName="transcoding">
<where>target_format = 'flv' and source_format in ('avi', 'mpg', 'mpeg', 'mp4', 'm4v', 'mkv', 'mov', 'wmv', 'ogv')</where>
</delete>
<insert tableName="transcoding">
<column name="name" value="avi > flv"/>
<column name="source_format" value="avi" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'avi > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="mpg > flv"/>
<column name="source_format" value="mpg" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'mpg > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="mpeg > flv"/>
<column name="source_format" value="mpeg" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'mpeg > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="mp4 > flv"/>
<column name="source_format" value="mp4" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'mp4 > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="m4v > flv"/>
<column name="source_format" value="m4v" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'm4v > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="mkv > flv"/>
<column name="source_format" value="mkv" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'mkv > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="mov > flv"/>
<column name="source_format" value="mov" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'mov > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="wmv > flv"/>
<column name="source_format" value="wmv" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'wmv > flv'
</sql>
<insert tableName="transcoding">
<column name="name" value="ogv > flv"/>
<column name="source_format" value="ogv" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -" />
<column name="enabled" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding(player_id, transcoding_id) select p.id as player_id, t.id as transaction_id from player p, transcoding t where t.name = 'ogv > flv'
</sql>
<rollback/>
</changeSet>
<changeSet id="schema43_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user" columnName="email" />
</not>
</preConditions>
<addColumn tableName="user">
<column name="email" type="${varchar_type}"/>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,84 @@
<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.1.xsd">
<changeSet id="schema45_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 18</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="18" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 18</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema45_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from role where id = 11</sqlCheck>
</preConditions>
<insert tableName="role">
<column name="id" valueNumeric="11"/>
<column name="name" value="share" />
</insert>
<sql>
insert into user_role(username, role_id)
select distinct u.username, 11 from ${userTableQuote}user${userTableQuote} u, user_role ur
where u.username = ur.username and ur.role_id = 1
</sql>
<rollback />
</changeSet>
<changeSet id="schema45_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="share" />
</not>
</preConditions>
<createTable tableName="share">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="description" type="${varchar_type}" />
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="s_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true"/>
</column>
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
<column name="expires" type="datetime" />
<column name="last_visited" type="datetime" />
<column name="visit_count" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex unique="true" tableName="share" indexName="idx_share_name">
<column name="name"/>
</createIndex>
<sql dbms="hsql">
set table share type cached
</sql>
<createTable tableName="share_file">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="share_id" type="int">
<constraints nullable="false" foreignKeyName="sf_s_fk" referencedTableName="share" referencedColumnNames="id" deleteCascade="true"/>
</column>
<column name="path" type="${varchar_type}" >
<constraints nullable="false" />
</column>
</createTable>
<sql dbms="hsql">
set table share_file type cached
</sql>
<rollback>
<dropTable tableName="share" />
<dropTable tableName="share_file" />
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,94 @@
<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.1.xsd">
<changeSet id="schema46_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 19</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="19" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 19</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema46_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="transcoding2" />
</not>
</preConditions>
<createTable tableName="transcoding2">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="source_formats" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="target_format" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="step1" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="step2" type="${varchar_type}" />
<column name="step3" type="${varchar_type}" />
</createTable>
<insert tableName="transcoding2">
<column name="name" value="mp3 audio" />
<column name="source_formats" value="ogg oga aac m4a flac wav wma aif aiff ape mpc shn" />
<column name="target_format" value="mp3" />
<column name="step1" value="ffmpeg -i %s -ab %bk -v 0 -f mp3 -"/>
</insert>
<insert tableName="transcoding2">
<column name="name" value="flv/h264 video" />
<column name="source_formats" value="avi mpg mpeg mp4 m4v mkv mov wmv ogv divx m2ts" />
<column name="target_format" value="flv" />
<column name="step1" value="ffmpeg -ss %o -i %s -async 1 -b %bk -s %wx%h -ar 44100 -ac 2 -v 0 -f flv -vcodec libx264 -preset superfast -threads 0 -"/>
</insert>
<rollback>
<dropTable tableName="transcoding2" />
</rollback>
</changeSet>
<changeSet id="schema46_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="player_transcoding2" />
</not>
</preConditions>
<createTable tableName="player_transcoding2">
<column name="player_id" type="int">
<constraints nullable="false" foreignKeyName="pt2_p_fk" referencedTableName="player" referencedColumnNames="id" deleteCascade="true"/>
</column>
<column name="transcoding_id" type="int" >
<constraints nullable="false" foreignKeyName="pt2_t_fk" referencedTableName="transcoding2" referencedColumnNames="id" deleteCascade="true"/>
</column>
</createTable>
<addPrimaryKey tableName="player_transcoding2" columnNames="player_id,transcoding_id" />
<sql>
insert into player_transcoding2(player_id, transcoding_id)
select distinct p.id, t.id from player p, transcoding2 t
</sql>
<rollback>
<dropTable tableName="player_transcoding2" />
</rollback>
</changeSet>
<changeSet id="schema46_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="transcoding2" columnName="default_active" />
</not>
</preConditions>
<addColumn tableName="transcoding2">
<column name="default_active" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,450 @@
<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.1.xsd">
<changeSet id="schema47_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 20</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="20" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 20</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema47_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="media_file" />
</not>
</preConditions>
<createTable tableName="media_file">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="path" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="folder" type="${varchar_type}" />
<column name="type" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="format" type="${varchar_type}" />
<column name="title" type="${varchar_type}" />
<column name="album" type="${varchar_type}" />
<column name="artist" type="${varchar_type}" />
<column name="album_artist" type="${varchar_type}" />
<column name="disc_number" type="int" />
<column name="track_number" type="int" />
<column name="year" type="int" />
<column name="genre" type="${varchar_type}" />
<column name="bit_rate" type="int" />
<column name="variable_bit_rate" type="boolean" >
<constraints nullable="false" />
</column>
<column name="duration_seconds" type="int" />
<column name="file_size" type="bigint" />
<column name="width" type="int" />
<column name="height" type="int" />
<column name="cover_art_path" type="${varchar_type}" />
<column name="parent_path" type="${varchar_type}" />
<column name="play_count" type="int" >
<constraints nullable="false" />
</column>
<column name="last_played" type="datetime" />
<column name="comment" type="${varchar_type}" />
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
<column name="changed" type="datetime" >
<constraints nullable="false" />
</column>
<column name="last_scanned" type="datetime" >
<constraints nullable="false" />
</column>
<column name="children_last_updated" type="datetime" >
<constraints nullable="false" />
</column>
<column name="present" type="boolean" >
<constraints nullable="false" />
</column>
<column name="version" type="int" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex unique="true" tableName="media_file" indexName="idx_media_file_path">
<column name="path"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_parent_path">
<column name="parent_path"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_type">
<column name="type"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_album">
<column name="album"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_artist">
<column name="artist"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_album_artist">
<column name="album_artist"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_present">
<column name="present"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_genre">
<column name="genre"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_play_count">
<column name="play_count"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_created">
<column name="created"/>
</createIndex>
<createIndex tableName="media_file" indexName="idx_media_file_last_played">
<column name="last_played"/>
</createIndex>
<sql dbms="hsql">
set table media_file type cached
</sql>
<rollback>
<dropTable tableName="media_file" />
</rollback>
</changeSet>
<changeSet id="schema47_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="artist" />
</not>
</preConditions>
<createTable tableName="artist">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="cover_art_path" type="${varchar_type}" />
<column name="album_count" type="int" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="last_scanned" type="datetime" >
<constraints nullable="false" />
</column>
<column name="present" type="boolean" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex tableName="artist" indexName="idx_artist_name" unique="true">
<column name="name"/>
</createIndex>
<createIndex tableName="artist" indexName="idx_artist_present" >
<column name="present"/>
</createIndex>
<sql dbms="hsql">
set table artist type cached
</sql>
<rollback>
<dropTable tableName="artist" />
</rollback>
</changeSet>
<changeSet id="schema47_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="album" />
</not>
</preConditions>
<createTable tableName="album">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="path" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="artist" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="song_count" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
<column name="duration_seconds" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
<column name="cover_art_path" type="${varchar_type}" />
<column name="play_count" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
<column name="last_played" type="datetime" />
<column name="comment" type="${varchar_type}" />
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
<column name="last_scanned" type="datetime" >
<constraints nullable="false" />
</column>
<column name="present" type="boolean" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex tableName="album" indexName="idx_album_artist_name" unique="true">
<column name="artist" />
<column name="name"/>
</createIndex>
<createIndex tableName="album" indexName="idx_album_play_count" >
<column name="play_count"/>
</createIndex>
<createIndex tableName="album" indexName="idx_album_last_played" >
<column name="last_played"/>
</createIndex>
<createIndex tableName="album" indexName="idx_album_present" >
<column name="present"/>
</createIndex>
<sql dbms="hsql">
set table album type cached
</sql>
<rollback>
<dropTable tableName="album" />
</rollback>
</changeSet>
<changeSet id="schema47_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="idx_album_name" />
</not>
</preConditions>
<createIndex tableName="album" indexName="idx_album_name">
<column name="name"/>
</createIndex>
</changeSet>
<changeSet id="schema47_006" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="starred_media_file" />
</not>
</preConditions>
<createTable tableName="starred_media_file">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="media_file_id" type="int" >
<constraints nullable="false" foreignKeyName="smf_mf_fk" referencedTableName="media_file" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="smf_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex tableName="starred_media_file" indexName="idx_starred_media_file_media_file_id">
<column name="media_file_id"/>
</createIndex>
<createIndex tableName="starred_media_file" indexName="idx_starred_media_file_username">
<column name="username"/>
</createIndex>
<addUniqueConstraint tableName="starred_media_file" columnNames="media_file_id,username" />
<rollback>
<dropTable tableName="starred_media_file" />
</rollback>
</changeSet>
<changeSet id="schema47_007" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="starred_album" />
</not>
</preConditions>
<createTable tableName="starred_album">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="album_id" type="int" >
<constraints nullable="false" foreignKeyName="sa_a_fk" referencedTableName="album" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="sa_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex tableName="starred_album" indexName="idx_starred_album_album_id">
<column name="album_id"/>
</createIndex>
<createIndex tableName="starred_album" indexName="idx_starred_album_username">
<column name="username"/>
</createIndex>
<addUniqueConstraint tableName="starred_album" columnNames="album_id,username" />
<rollback>
<dropTable tableName="starred_album" />
</rollback>
</changeSet>
<changeSet id="schema47_008" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="starred_artist" />
</not>
</preConditions>
<createTable tableName="starred_artist">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="artist_id" type="int">
<constraints nullable="false" foreignKeyName="sar_a_fk" referencedTableName="artist" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="sar_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex tableName="starred_artist" indexName="idx_starred_artist_artist_id">
<column name="artist_id"/>
</createIndex>
<createIndex tableName="starred_artist" indexName="idx_starred_artist_username">
<column name="username"/>
</createIndex>
<addUniqueConstraint tableName="starred_artist" columnNames="artist_id,username" />
<rollback>
<dropTable tableName="starred_artist" />
</rollback>
</changeSet>
<changeSet id="schema47_009" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="playlist" />
</not>
</preConditions>
<createTable tableName="playlist">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="p_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
<column name="is_public" type="boolean" >
<constraints nullable="false" />
</column>
<column name="name" type="${varchar_type}" >
<constraints nullable="false" />
</column>
<column name="comment" type="${varchar_type}" />
<column name="file_count" type="int" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
<column name="duration_seconds" type="int" defaultValueNumeric="0" >
<constraints nullable="false" />
</column>
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
<column name="changed" type="datetime" >
<constraints nullable="false" />
</column>
</createTable>
<rollback>
<dropTable tableName="playlist" />
</rollback>
</changeSet>
<changeSet id="schema47_010" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="playlist" columnName="imported_from" />
</not>
</preConditions>
<addColumn tableName="playlist">
<column name="imported_from" type="${varchar_type}"/>
</addColumn>
</changeSet>
<changeSet id="schema47_011" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="playlist_file" />
</not>
</preConditions>
<createTable tableName="playlist_file">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="playlist_id" type="int" >
<constraints nullable="false" foreignKeyName="pf_p_fk" referencedTableName="playlist" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="media_file_id" type="int" >
<constraints nullable="false" foreignKeyName="pf_mf_fk" referencedTableName="media_file" referencedColumnNames="id" deleteCascade="true" />
</column>
</createTable>
<sql dbms="hsql">
set table playlist_file type cached
</sql>
<rollback>
<dropTable tableName="playlist_file" />
</rollback>
</changeSet>
<changeSet id="schema47_012" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="playlist_user" />
</not>
</preConditions>
<createTable tableName="playlist_user">
<column name="id" type="int" autoIncrement="true" >
<constraints primaryKey="true" />
</column>
<column name="playlist_id" type="int" >
<constraints nullable="false" foreignKeyName="pu_p_fk" referencedTableName="playlist" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="pu_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
</createTable>
<addUniqueConstraint tableName="playlist_user" columnNames="playlist_id,username" />
<rollback>
<dropTable tableName="playlist_user" />
</rollback>
</changeSet>
<changeSet id="schema47_013" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="bookmark" />
</not>
</preConditions>
<createTable tableName="bookmark">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="media_file_id" type="int" >
<constraints nullable="false" foreignKeyName="b_mf_fk" referencedTableName="media_file" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="position_millis" type="bigint" >
<constraints nullable="false" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="b_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
<column name="comment" type="${varchar_type}" />
<column name="created" type="datetime" >
<constraints nullable="false" />
</column>
<column name="changed" type="datetime" >
<constraints nullable="false" />
</column>
</createTable>
<createIndex tableName="bookmark" indexName="idx_bookmark_media_file_id">
<column name="media_file_id"/>
</createIndex>
<createIndex tableName="bookmark" indexName="idx_bookmark_username">
<column name="username"/>
</createIndex>
<addUniqueConstraint columnNames="media_file_id,username" tableName="bookmark" />
<rollback>
<dropTable tableName="bookmark" />
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,65 @@
<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.1.xsd">
<changeSet id="schema49_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 21</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="21" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 21</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema49_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="album" columnName="year" />
</not>
</preConditions>
<addColumn tableName="album">
<column name="year" type="int"/>
</addColumn>
</changeSet>
<changeSet id="schema49_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="album" columnName="genre" />
</not>
</preConditions>
<addColumn tableName="album">
<column name="genre" type="${varchar_type}"/>
</addColumn>
</changeSet>
<changeSet id="schema49_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="genre" />
</not>
</preConditions>
<createTable tableName="genre">
<column name="name" type="${varchar_type}">
<constraints nullable="false"/>
</column>
<column name="song_count" type="int" >
<constraints nullable="false" />
</column>
</createTable>
</changeSet>
<changeSet id="schema49_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="genre" columnName="album_count" />
</not>
</preConditions>
<addColumn tableName="genre">
<column name="album_count" type="int" defaultValueNumeric="0">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,64 @@
<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.1.xsd">
<changeSet id="schema50_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 22</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="22" />
</insert>
<insert tableName="transcoding2">
<column name="name" value="mkv video"/>
<column name="source_formats" value="avi mpg mpeg mp4 m4v mkv mov wmv ogv divx m2ts" />
<column name="target_format" value="mkv" />
<column name="step1" value="ffmpeg -ss %o -i %s -c:v libx264 -preset superfast -b:v %bk -c:a libvorbis -f matroska -threads 0 -" />
<column name="default_active" valueBoolean="true" />
</insert>
<sql>
insert into player_transcoding2(player_id, transcoding_id)
select distinct p.id, t.id from player p, transcoding2 t where t.name='mkv video'
</sql>
<rollback>
<delete tableName="version" >
<where>version = 22</where>
</delete>
<delete tableName="player_transcoding" >
<where>transcoding_id in (select id from transcoding_2 where name = 'mkv video')</where>
</delete>
<delete tableName="transcoding2" >
<where>name = 'mkv video'</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema50_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="song_notification" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="song_notification" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema50_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 23</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="23" />
</insert>
<update tableName="transcoding2">
<column name="step1" value="ffmpeg -i %s -map 0:0 -b:a %bk -v 0 -f mp3 -" />
<where>name='mp3 audio'</where>
</update>
<rollback>
<delete tableName="version" >
<where>version = 23</where>
</delete>
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,54 @@
<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.1.xsd">
<changeSet id="schema51_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 23</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="23" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 23</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema51_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="show_artist_info" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="show_artist_info" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema51_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="auto_hide_play_queue" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="auto_hide_play_queue" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema51_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="view_as_list" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="view_as_list" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,96 @@
<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.1.xsd">
<changeSet id="schema52_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 24</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="24" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 24</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema52_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="music_folder_user" />
</not>
</preConditions>
<createTable tableName="music_folder_user">
<column name="music_folder_id" type="int">
<constraints nullable="false" foreignKeyName="mfu_fm_fk" referencedTableName="music_folder" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="mfu_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
</createTable>
<createIndex tableName="music_folder_user" indexName="idx_music_folder_user_username">
<column name="username"/>
</createIndex>
</changeSet>
<changeSet id="schema52_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="album" columnName="folder_id"/>
</not>
</preConditions>
<addColumn tableName="album">
<column name="folder_id" type="int"/>
</addColumn>
</changeSet>
<changeSet id="schema52_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="play_queue" />
</not>
</preConditions>
<createTable tableName="play_queue">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="username" type="${varchar_type}" >
<constraints nullable="false" foreignKeyName="pq_u_fk" referencedTableName="user" referencedColumnNames="username" deleteCascade="true" />
</column>
<column name="current" type="int" />
<column name="position_millis" type="bigint" />
<column name="changed" type="datetime" >
<constraints nullable="false" />
</column>
<column name="changed_by" type="${varchar_type}" >
<constraints nullable="false" />
</column>
</createTable>
<rollback>
<dropTable tableName="play_queue" />
</rollback>
</changeSet>
<changeSet id="schema52_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="play_queue_file" />
</not>
</preConditions>
<createTable tableName="play_queue_file">
<column name="id" type="int" autoIncrement="true">
<constraints primaryKey="true" />
</column>
<column name="play_queue_id" type="int" >
<constraints nullable="false" foreignKeyName="pqf_pq_fk" referencedTableName="play_queue" referencedColumnNames="id" deleteCascade="true" />
</column>
<column name="media_file_id" type="int" >
<constraints nullable="false" foreignKeyName="pqf_mf_fk" referencedTableName="media_file" referencedColumnNames="id" deleteCascade="true" />
</column>
</createTable>
<sql dbms="hsql">
set table play_queue_file type cached
</sql>
<rollback>
<dropTable tableName="play_queue_file" />
</rollback>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,84 @@
<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.1.xsd">
<changeSet id="schema53_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 25</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="25" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 25</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema53_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<indexExists indexName="idx_podcast_episode_url" />
</not>
</preConditions>
<createIndex tableName="podcast_episode" indexName="idx_podcast_episode_url">
<column name="url"/>
</createIndex>
</changeSet>
<changeSet id="schema53_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="default_album_list" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="default_album_list" type="${varchar_type}" defaultValue="random">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema53_004" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="queue_following_songs" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="queue_following_songs" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema53_005" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="podcast_channel" columnName="image_url" />
</not>
</preConditions>
<addColumn tableName="podcast_channel">
<column name="image_url" type="${varchar_type}" />
</addColumn>
</changeSet>
<changeSet id="schema53_006" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="show_side_bar" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="show_side_bar" type="boolean" defaultValueBoolean="true">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema53_007" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="artist" columnName="folder_id" />
</not>
</preConditions>
<addColumn tableName="artist">
<column name="folder_id" type="int"/>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,42 @@
<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.1.xsd">
<changeSet id="schema61_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 26</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="26" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 26</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema61_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="list_reload_delay" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="list_reload_delay" type="int" defaultValueNumeric="60">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
<changeSet id="schema61_003" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="user_settings" columnName="keyboard_shortcuts_enabled" />
</not>
</preConditions>
<addColumn tableName="user_settings">
<column name="keyboard_shortcuts_enabled" type="boolean" defaultValueBoolean="false">
<constraints nullable="false" />
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,30 @@
<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.1.xsd">
<changeSet id="schema62_001" author="muff1nman">
<preConditions onFail="MARK_RAN">
<sqlCheck expectedResult="0">select count(*) from version where version = 27</sqlCheck>
</preConditions>
<insert tableName="version">
<column name="version" valueNumeric="27" />
</insert>
<rollback>
<delete tableName="version" >
<where>version = 27</where>
</delete>
</rollback>
</changeSet>
<changeSet id="schema62_002" author="muff1nman">
<preConditions onFail="MARK_RAN">
<not>
<columnExists tableName="player" columnName="m3u_bom_enabled" />
</not>
</preConditions>
<addColumn tableName="player">
<column name="m3u_bom_enabled" type="boolean" defaultValueBoolean="false">
<constraints nullable="false"/>
</column>
</addColumn>
</changeSet>
</databaseChangeLog>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd"
profile="embed">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${database.config.embed.driver}" />
<property name="url" value="${database.config.embed.url}" />
<property name="username" value="${database.config.embed.username}" />
<property name="password" value="${database.config.embed.password}" />
</bean>
</beans>

@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd"
profile="jndi">
<jee:jndi-lookup id="dataSource"
jndi-name="${database.config.jndi.name}"
expected-type="javax.sql.DataSource" />
</beans>

@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jee="http://www.springframework.org/schema/jee"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd"
profile="legacy">
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:file:#{systemProperties['libresonic.home']}/db/libresonic" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
</beans>

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<import resource="applicationContext-db-jndi.xml" />
<import resource="applicationContext-db-embed.xml" />
<import resource="applicationContext-db-legacy.xml" />
<bean id="daoHelper" class="org.libresonic.player.dao.GenericDaoHelper">
<constructor-arg name="jdbcTemplate" ref="jdbcTemplate" />
<constructor-arg name="namedParameterJdbcTemplate" ref="namedJdbcTemplate" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
<constructor-arg name="dataSource" ref="dataSource" />
</bean>
<bean id="namedJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate" >
<constructor-arg name="dataSource" ref="dataSource" />
</bean>
<bean id="rollbackFile" class="java.io.File">
<constructor-arg name="parent" value="#{T(org.libresonic.player.service.SettingsService).libresonicHome}" />
<constructor-arg name="child" value="rollback.sql" />
</bean>
<bean id="userTableQuote" class="java.lang.String">
<constructor-arg value="${database.usertable.quote:}" />
</bean>
<bean id="liquibase" class="org.libresonic.player.spring.SpringLiquibase">
<property name="dataSource" ref="dataSource" />
<property name="changeLog" value="classpath:liquibase/db-changelog.xml" />
<property name="rollbackFile" ref="rollbackFile" />
<property name="changeLogParameters">
<map>
<entry key="defaultMusicFolder" value="#{T(org.libresonic.player.util.Util).getDefaultMusicFolder()}" />
<entry key="varcharLimit" value="${database.varchar.maxlength:512}" />
<entry key="userTableQuote" value-ref="userTableQuote" />
</map>
</property>
</bean>
</beans>

@ -2,7 +2,12 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
<context:property-placeholder />
<import resource="applicationContext-db.xml" />
<!-- DAO's -->
@ -44,6 +49,7 @@
<bean id="userDao" class="org.libresonic.player.dao.UserDao">
<property name="daoHelper" ref="daoHelper"/>
<property name="userTableQuote" ref="userTableQuote"/>
</bean>
<bean id="transcodingDao" class="org.libresonic.player.dao.TranscodingDao">
@ -66,9 +72,6 @@
<property name="daoHelper" ref="daoHelper"/>
</bean>
<bean id="daoHelper" class="org.libresonic.player.dao.DaoHelperFactory" factory-method="create"/>
<!-- Services -->
<bean id="mediaFileService" class="org.libresonic.player.service.MediaFileService">

@ -1,11 +1,21 @@
package org.libresonic.player.dao;
import javax.sql.DataSource;
import junit.framework.TestCase;
import liquibase.exception.LiquibaseException;
import org.libresonic.player.TestCaseUtils;
import org.libresonic.player.service.SettingsService;
import org.libresonic.player.spring.SpringLiquibase;
import org.libresonic.player.util.FileUtil;
import org.libresonic.player.util.Util;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
/**
* Superclass for all DAO test cases.
@ -32,7 +42,10 @@ public abstract class DaoTestCaseBase extends TestCase {
protected PodcastDao podcastDao;
protected DaoTestCaseBase() {
daoHelper = new HsqlDaoHelper();
DataSource dataSource = createDataSource();
daoHelper = new GenericDaoHelper(new JdbcTemplate(dataSource), new NamedParameterJdbcTemplate(dataSource));
runDatabaseMigration(dataSource);
playerDao = new PlayerDao();
internetRadioDao = new InternetRadioDao();
@ -57,6 +70,34 @@ public abstract class DaoTestCaseBase extends TestCase {
getJdbcTemplate().execute("shutdown");
}
private void runDatabaseMigration(DataSource dataSource) {
SpringLiquibase springLiquibase = new SpringLiquibase();
springLiquibase.setDataSource(dataSource);
springLiquibase.setChangeLog("classpath:liquibase/db-changelog.xml");
springLiquibase.setResourceLoader(new DefaultResourceLoader());
Map<String,String> parameters = new HashMap<>();
parameters.put("defaultMusicFolder", Util.getDefaultMusicFolder());
parameters.put("varcharLimit", "512");
parameters.put("userTableQuote", "");
springLiquibase.setChangeLogParameters(parameters);
try {
springLiquibase.afterPropertiesSet();
} catch (LiquibaseException e) {
throw new RuntimeException(e);
}
}
private DataSource createDataSource() {
File libresonicHome = SettingsService.getLibresonicHome();
DriverManagerDataSource ds = new DriverManagerDataSource();
ds.setDriverClassName("org.hsqldb.jdbcDriver");
ds.setUrl("jdbc:hsqldb:file:" + libresonicHome.getPath() + "/db/libresonic");
ds.setUsername("sa");
ds.setPassword("");
return ds;
}
protected JdbcTemplate getJdbcTemplate() {
return daoHelper.getJdbcTemplate();
}

@ -41,7 +41,13 @@ public class SettingsServiceTestCase extends TestCase {
String libresonicHome = TestCaseUtils.libresonicHomePathForTest();
System.setProperty("libresonic.home", libresonicHome);
new File(libresonicHome, "libresonic.properties").delete();
settingsService = new SettingsService();
settingsService = newSettingsService();
}
private SettingsService newSettingsService() {
SettingsService settingsService = new SettingsService();
settingsService.setConfigurationService(new ApacheCommonsConfigurationService());
return settingsService;
}
public void testLibresonicHome() {
@ -97,7 +103,7 @@ public class SettingsServiceTestCase extends TestCase {
settingsService.save();
verifySettings(settingsService);
verifySettings(new SettingsService());
verifySettings(newSettingsService());
}
private void verifySettings(SettingsService ss) {

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- DAO's -->
@ -67,8 +67,45 @@
<property name="daoHelper" ref="daoHelper"/>
</bean>
<bean id="daoHelper" class="org.libresonic.player.dao.DaoHelperFactory" factory-method="create"/>
<bean id="daoHelper" class="org.libresonic.player.dao.GenericDaoHelper">
<constructor-arg name="jdbcTemplate" ref="jdbcTemplate" />
<constructor-arg name="namedParameterJdbcTemplate" ref="namedJdbcTemplate" />
</bean>
<bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate" >
<constructor-arg name="dataSource" ref="dataSource" />
</bean>
<bean id="namedJdbcTemplate" class="org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate" >
<constructor-arg name="dataSource" ref="dataSource" />
</bean>
<bean id="rollbackFile" class="java.io.File">
<constructor-arg name="parent" value="#{T(org.libresonic.player.service.SettingsService).libresonicHome}" />
<constructor-arg name="child" value="rollback.sql" />
</bean>
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="org.hsqldb.jdbcDriver" />
<property name="url" value="jdbc:hsqldb:file:#{systemProperties['libresonic.home']}/db/libresonic" />
<property name="username" value="sa" />
<property name="password" value="" />
</bean>
<bean id="liquibase" class="org.libresonic.player.spring.SpringLiquibase">
<property name="dataSource" ref="dataSource" />
<property name="changeLog" value="classpath:liquibase/db-changelog.xml" />
<property name="rollbackFile" ref="rollbackFile" />
<property name="changeLogParameters">
<map>
<entry key="defaultMusicFolder" value="#{T(org.libresonic.player.util.Util).getDefaultMusicFolder()}" />
<entry key="varcharLimit" value="${database.varchar.maxlength:512}" />
<entry key="userTableQuote" value="" />
</map>
</property>
</bean>
<!-- Services -->
@ -87,12 +124,15 @@
<property name="userCache" ref="userCache"/>
</bean>
<bean id="configurationService" class="org.libresonic.player.service.ApacheCommonsConfigurationService" />
<bean id="settingsService" class="org.libresonic.player.service.SettingsService" init-method="init">
<property name="internetRadioDao" ref="internetRadioDao"/>
<property name="musicFolderDao" ref="musicFolderDao"/>
<property name="userDao" ref="userDao"/>
<property name="avatarDao" ref="avatarDao"/>
<property name="versionService" ref="versionService"/>
<property name="configurationService" ref="configurationService" />
</bean>
<bean id="mediaScannerService" class="org.libresonic.player.service.MediaScannerService" init-method="initNoSchedule" depends-on="metaDataParserFactory">

Loading…
Cancel
Save