Skip to content

Commit

Permalink
Replace database.xml with a Migration script on Nextcloud
Browse files Browse the repository at this point in the history
Nextcloud 22 drops the support for defining database schema with
database.xml. Instead, the database schema should now be defined using
a Migration script. The migration script here has been generated from
the database.xml with `occ migrations:generate-from-schema`.

All supported versions of Nextcloud can use the migration script but ownCloud
cannot. Hence, we still need to keep also database.xml around, and just
remove it when deploying for Nextcloud. The removing now happens with
 `make release` which now creates two separate packages, one for Nextcloud
and another for ownCloud.
  • Loading branch information
paulijar committed May 22, 2021
1 parent 019dc11 commit 6982d91
Show file tree
Hide file tree
Showing 3 changed files with 412 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ matrix:
branches:
only:
- master
- travis

cache:
directories:
Expand All @@ -74,6 +75,11 @@ before_install:
# The Nextcloud version in the master branch is almost always one which is not yet officially supported by the Music app. To enable testing, hack the supported NC version to a high value.
- sh -c "if [ '$CLOUD' = 'nextcloud' ] && [ $CORE_VER = 'master' ]; then sed -i -r 's/(<nextcloud min-version=\"..\" max-version=\")../\1255/g' appinfo/info.xml; fi;"

# Nextcloud has deprecated the use of database.xml to specify the database schema a long time ago, and NC22 removes the support entirely.
# Meanwhile, the replacement "Migrations" system does not work with ownCloud which still happily uses database.xml. To overcome this, our source
# repository contains both mechanisms. The database.xml is deleted when deploying for NC, and the migrations script is disregarded by oC by default.
- if [[ "$CLOUD" == 'nextcloud' ]]; then rm appinfo/database.xml; fi

- cd ..
- sh -c "if [ '$CLOUD' = 'nextcloud' ]; then git clone https://github.com/nextcloud/server.git --recursive --depth 1 -b $CORE_VER core; fi;"
- sh -c "if [ '$CLOUD' = 'owncloud' ]; then wget https://download.owncloud.org/community/owncloud-${CORE_VER}.zip; unzip owncloud-${CORE_VER}.zip; mv owncloud core; fi;"
Expand Down
6 changes: 5 additions & 1 deletion build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,8 @@ release:
zip -d music/music.zip "music/js/*.js*" && \
zip -d music/music.zip "music/js/*/*" && \
zip -d music/music.zip "music/l10n/*/*" && \
zip -d music/music.zip "music/tests/*"
zip -d music/music.zip "music/tests/*" && \
cp music/music.zip music/music-nc.zip && \
mv music/music.zip music/music-oc.zip && \
zip -d music/music-nc.zip "music/appinfo/database.xml" && \
zip -d music/music-oc.zip "music/lib/Migration/Version*Date*.php"
Loading

0 comments on commit 6982d91

Please # to comment.