mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-09-05 11:06:23 -07:00
Update migration subject scripts and initial gochan db version
This commit is contained in:
parent
5761662393
commit
a92b120b62
6 changed files with 22 additions and 20 deletions
|
@ -294,4 +294,4 @@ CREATE TABLE DBPREFIXfilter_hits(
|
|||
|
||||
|
||||
INSERT INTO DBPREFIXdatabase_version(component, version)
|
||||
VALUES('gochan', 3);
|
||||
VALUES('gochan', 4);
|
||||
|
|
|
@ -294,4 +294,4 @@ CREATE TABLE DBPREFIXfilter_hits(
|
|||
|
||||
|
||||
INSERT INTO DBPREFIXdatabase_version(component, version)
|
||||
VALUES('gochan', 3);
|
||||
VALUES('gochan', 4);
|
||||
|
|
|
@ -294,4 +294,4 @@ CREATE TABLE DBPREFIXfilter_hits(
|
|||
|
||||
|
||||
INSERT INTO DBPREFIXdatabase_version(component, version)
|
||||
VALUES('gochan', 3);
|
||||
VALUES('gochan', 4);
|
||||
|
|
|
@ -294,4 +294,4 @@ CREATE TABLE DBPREFIXfilter_hits(
|
|||
|
||||
|
||||
INSERT INTO DBPREFIXdatabase_version(component, version)
|
||||
VALUES('gochan', 3);
|
||||
VALUES('gochan', 4);
|
||||
|
|
|
@ -53,7 +53,7 @@ if [ "$DBTYPE" = "mysql" ]; then
|
|||
EOF1
|
||||
elif [ "$DBTYPE" = "postgresql" ]; then
|
||||
echo "Creating pre-2021 PostgreSQL DB 'gochan_pre2021' if it doesn't already exist"
|
||||
sed -i /etc/gochan/gochan.json \
|
||||
sed -i gochan.json \
|
||||
-e 's/"DBhost": ".*"/"DBhost": "127.0.0.1"/'
|
||||
sudo -u postgres psql -f - <<- EOF1
|
||||
CREATE DATABASE gochan_pre2021;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
set -euo pipefail
|
||||
|
||||
TESTING_VERSION="v3.7.0"
|
||||
TESTING_VERSION="v3.10.2"
|
||||
RELEASE_DIR="gochan-${TESTING_VERSION}_linux"
|
||||
RELEASE_GZ="$RELEASE_DIR.tar.gz"
|
||||
RELEASE_URL="https://github.com/gochan-org/gochan/releases/download/$TESTING_VERSION/$RELEASE_GZ"
|
||||
|
@ -23,39 +23,41 @@ echo "Extracting $RELEASE_GZ"
|
|||
tar -xf gochan-${TESTING_VERSION}_linux.tar.gz
|
||||
cd $RELEASE_DIR
|
||||
|
||||
cp sample-configs/gochan.example.json gochan.json
|
||||
cp examples/configs/gochan.example.json gochan.json
|
||||
echo "Modifying $PWD/gochan.json for testing migration"
|
||||
sed -i gochan.json \
|
||||
-e 's/"Port": .*/"Port": 9000,/' \
|
||||
-e 's/"UseFastCGI": false/"UseFastCGI": true/' \
|
||||
-e "s/\"DBtype\": .*/\"DBtype\": \""$DBTYPE"\",/" \
|
||||
-e 's/"DBpassword": ""/"DBpassword": "gochan"/' \
|
||||
-e 's/"LogDir": .*/"LogDir": "log"/' \
|
||||
-e 's/"TemplateDir": .*/"TemplateDir": "templates"/' \
|
||||
-e 's/"DocumentRoot": .*/"DocumentRoot": "html"/' \
|
||||
-e 's/"DBname": "gochan"/"DBname": "gochan_37"/' \
|
||||
-e 's/"DBprefix": .*/"DBprefix": ""/' \
|
||||
-e 's/"LogDir": .*/"LogDir": "log",/' \
|
||||
-e 's/"TemplateDir": .*/"TemplateDir": "templates",/' \
|
||||
-e 's/"DocumentRoot": .*/"DocumentRoot": "html",/' \
|
||||
-e 's/"DBname": "gochan"/"DBname": "gochan_prev"/' \
|
||||
-e 's/"DBprefix": .*/"DBprefix": "",/' \
|
||||
-e 's/"SiteName": "Gochan"/"SiteName": "Gochan Migration Test"/' \
|
||||
-e 's/"SiteSlogan": ""/"SiteSlogan": "Gochan instance used for testing gochan-migrate -updatedb"/' \
|
||||
-e 's/"DebugMode": false/"DebugMode": true/' \
|
||||
-e 's/"Verbosity": 0/"Verbosity": 1/'
|
||||
-e 's/"Verbosity": 0/"Verbosity": 1/' \
|
||||
-e 's/"GeoIPType": .*/"GeoIPType": "",/'
|
||||
-e 's/"EnableGeoIP": .*/"EnableGeoIP": false,/'
|
||||
|
||||
if [ "$DBTYPE" = "mysql" ]; then
|
||||
echo "Creating testing MySQL DB 'gochan_37' if it doesn't already exist"
|
||||
echo "Creating testing MySQL DB 'gochan_prev' if it doesn't already exist"
|
||||
sudo mysql <<- EOF1
|
||||
CREATE DATABASE IF NOT EXISTS gochan_37;
|
||||
CREATE DATABASE IF NOT EXISTS gochan_prev;
|
||||
GRANT USAGE ON *.* TO gochan IDENTIFIED BY 'gochan'; \
|
||||
GRANT ALL PRIVILEGES ON gochan_37.* TO gochan; \
|
||||
GRANT ALL PRIVILEGES ON gochan_prev.* TO gochan; \
|
||||
SET PASSWORD FOR 'gochan'@'%' = PASSWORD('gochan');
|
||||
FLUSH PRIVILEGES;
|
||||
EOF1
|
||||
elif [ "$DBTYPE" = "postgresql" ]; then
|
||||
echo "Creating testing PostgreSQL DB 'gochan_37' if it doesn't already exist"
|
||||
sed -i /etc/gochan/gochan.json \
|
||||
echo "Creating testing PostgreSQL DB 'gochan_prev' if it doesn't already exist"
|
||||
sed -i gochan.json \
|
||||
-e 's/"DBhost": ".*"/"DBhost": "127.0.0.1"/'
|
||||
sudo -u postgres psql -f - <<- EOF1
|
||||
CREATE DATABASE gochan_37;
|
||||
GRANT ALL PRIVILEGES ON DATABASE gochan_37 TO gochan;
|
||||
CREATE DATABASE gochan_prev;
|
||||
GRANT ALL PRIVILEGES ON DATABASE gochan_prev TO gochan;
|
||||
EOF1
|
||||
else
|
||||
echo "Currently using unsupported \$DBTYPE: $DBTYPE"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue