mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-05 04:36:24 -07:00
Merge pull request #73 from gochan-org/mysql-compatibility
Fix compatibility with mainline MySQL
This commit is contained in:
commit
5de1d61a3d
13 changed files with 122 additions and 49 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "gochan.js",
|
"name": "gochan.js",
|
||||||
"version": "3.5.0",
|
"version": "3.5.1",
|
||||||
"description": "",
|
"description": "",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"source": "js/gochan.js",
|
"source": "js/gochan.js",
|
||||||
|
|
|
@ -7,6 +7,6 @@
|
||||||
<h1>404: File not found</h1>
|
<h1>404: File not found</h1>
|
||||||
<img src="./lol 404.gif" border="0" alt="">
|
<img src="./lol 404.gif" border="0" alt="">
|
||||||
<p>The requested file could not be found on this server.</p>
|
<p>The requested file could not be found on this server.</p>
|
||||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.5.0
|
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.5.1
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -7,6 +7,6 @@
|
||||||
<h1>Error 500: Internal Server error</h1>
|
<h1>Error 500: Internal Server error</h1>
|
||||||
<img src="./server500.gif" border="0" alt="">
|
<img src="./server500.gif" border="0" alt="">
|
||||||
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
|
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
|
||||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.5.0
|
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.5.1
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -7,6 +7,6 @@
|
||||||
<h1>Error 502: Bad gateway</h1>
|
<h1>Error 502: Bad gateway</h1>
|
||||||
<img src="./server500.gif" border="0" alt="">
|
<img src="./server500.gif" border="0" alt="">
|
||||||
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
|
<p>The server encountered an error while trying to serve the page, and we apologize for the inconvenience. The <a href="https://en.wikipedia.org/wiki/Idiot">system administrator</a> will try to fix things as soon they get around to it, whenever that is. Hopefully soon.</p>
|
||||||
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.5.0
|
<hr/>Site powered by <a href="https://github.com/gochan-org/gochan" target="_blank">Gochan</a> v3.5.1
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
|
@ -4,6 +4,8 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/gochan-org/gochan/pkg/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -27,15 +29,20 @@ func RunSQLFile(path string) error {
|
||||||
sqlStr := regexp.MustCompile("--.*\n?").ReplaceAllString(string(sqlBytes), " ")
|
sqlStr := regexp.MustCompile("--.*\n?").ReplaceAllString(string(sqlBytes), " ")
|
||||||
sqlArr := strings.Split(gcdb.replacer.Replace(sqlStr), ";")
|
sqlArr := strings.Split(gcdb.replacer.Replace(sqlStr), ";")
|
||||||
|
|
||||||
|
tx, err := BeginTx()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer tx.Rollback()
|
||||||
for _, statement := range sqlArr {
|
for _, statement := range sqlArr {
|
||||||
statement = strings.Trim(statement, " \n\r\t")
|
statement = strings.Trim(statement, " \n\r\t")
|
||||||
if len(statement) > 0 {
|
if len(statement) > 0 {
|
||||||
if _, err = gcdb.db.Exec(statement); err != nil {
|
if _, err = ExecTxSQL(tx, statement); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return tx.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: get gochan-migration working so this doesn't have to sit here
|
// TODO: get gochan-migration working so this doesn't have to sit here
|
||||||
|
@ -46,33 +53,87 @@ func tmpSqlAdjust() error {
|
||||||
switch gcdb.driver {
|
switch gcdb.driver {
|
||||||
case "mysql":
|
case "mysql":
|
||||||
query = `SELECT COUNT(*) FROM information_schema.TABLE_CONSTRAINTS
|
query = `SELECT COUNT(*) FROM information_schema.TABLE_CONSTRAINTS
|
||||||
WHERE CONSTRAINT_NAME = 'wordfilters_staff_id_fk'
|
WHERE CONSTRAINT_NAME = 'wordfilters_board_id_fk'
|
||||||
AND TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'DBPREFIXwordfilters'`
|
AND TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'DBPREFIXwordfilters'`
|
||||||
numConstraints := 3
|
var numConstraints int
|
||||||
if err = gcdb.QueryRowSQL(query,
|
if err = gcdb.QueryRowSQL(query,
|
||||||
interfaceSlice(),
|
interfaceSlice(),
|
||||||
interfaceSlice(&numConstraints)); err != nil {
|
interfaceSlice(&numConstraints)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if numConstraints > 0 {
|
if numConstraints > 0 {
|
||||||
query = `ALTER TABLE DBPREFIXwordfilters DROP FOREIGN KEY IF EXISTS wordfilters_board_id_fk`
|
query = `ALTER TABLE DBPREFIXwordfilters DROP FOREIGN KEY wordfilters_board_id_fk`
|
||||||
} else {
|
} else {
|
||||||
query = ""
|
query = ""
|
||||||
}
|
}
|
||||||
|
query = `SELECT COUNT(*) FROM information_schema.COLUMNS
|
||||||
|
WHERE TABLE_SCHEMA = DATABASE()
|
||||||
|
AND TABLE_NAME = 'DBPREFIXwordfilters'
|
||||||
|
AND COLUMN_NAME = 'board_dirs'`
|
||||||
|
var numColumns int
|
||||||
|
if err = gcdb.QueryRowSQL(query,
|
||||||
|
interfaceSlice(),
|
||||||
|
interfaceSlice(&numColumns)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if numColumns == 0 {
|
||||||
|
query = `ALTER TABLE DBPREFIXwordfilters ADD COLUMN board_dirs varchar(255) DEFAULT '*'`
|
||||||
|
if _, err = ExecSQL(query); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Yay, collation! Everybody loves MySQL's default collation!
|
||||||
|
criticalConfig := config.GetSystemCriticalConfig()
|
||||||
|
query = `ALTER DATABASE ` + criticalConfig.DBname + ` CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci`
|
||||||
|
if _, err = gcdb.db.Exec(query); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
query = `SELECT TABLE_NAME FROM information_schema.TABLES WHERE TABLE_SCHEMA = ?`
|
||||||
|
rows, err := QuerySQL(query, criticalConfig.DBname)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer rows.Close()
|
||||||
|
for rows.Next() {
|
||||||
|
var tableName string
|
||||||
|
err = rows.Scan(&tableName)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
query = `ALTER TABLE ` + tableName + ` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci`
|
||||||
|
if _, err = gcdb.db.Exec(query); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
err = nil
|
||||||
case "postgres":
|
case "postgres":
|
||||||
query = `ALTER TABLE DBPREFIXwordfilters DROP CONSTRAINT IF EXISTS board_id_fk`
|
_, err = ExecSQL(`ALTER TABLE DBPREFIXwordfilters DROP CONSTRAINT IF EXISTS board_id_fk`)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
query = `ALTER TABLE DBPREFIXwordfilters ADD COLUMN IF NOT EXISTS board_dirs varchar(255) DEFAULT '*'`
|
||||||
|
if _, err = ExecSQL(query); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
case "sqlite3":
|
case "sqlite3":
|
||||||
_, err = ExecSQL(`PRAGMA foreign_keys = ON`)
|
_, err = ExecSQL(`PRAGMA foreign_keys = ON`)
|
||||||
return err
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
query = `SELECT COUNT(*) FROM PRAGMA_TABLE_INFO('DBPREFIXwordfilters') WHERE name = 'board_dirs'`
|
||||||
|
var numColumns int
|
||||||
|
if err = QueryRowSQL(query, interfaceSlice(), interfaceSlice(&numColumns)); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if numColumns == 0 {
|
||||||
|
query = `ALTER TABLE DBPREFIXwordfilters ADD COLUMN board_dirs varchar(255) DEFAULT '*'`
|
||||||
|
if _, err = ExecSQL(query); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if _, err = gcdb.ExecSQL(query); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
query = `ALTER TABLE DBPREFIXwordfilters DROP COLUMN IF EXISTS board_id`
|
|
||||||
if _, err = gcdb.ExecSQL(query); err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
query = `ALTER TABLE DBPREFIXwordfilters ADD COLUMN IF NOT EXISTS board_dirs varchar(255) DEFAULT '*'`
|
|
||||||
_, err = gcdb.ExecSQL(query)
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ func CheckAndInitializeDatabase(dbType string) error {
|
||||||
func buildNewDatabase(dbType string) error {
|
func buildNewDatabase(dbType string) error {
|
||||||
var err error
|
var err error
|
||||||
if err = initDB("initdb_" + dbType + ".sql"); err != nil {
|
if err = initDB("initdb_" + dbType + ".sql"); err != nil {
|
||||||
return errors.New("database initialization failed: " + err.Error())
|
return err
|
||||||
}
|
}
|
||||||
if err = createDefaultAdminIfNoStaff(); err != nil {
|
if err = createDefaultAdminIfNoStaff(); err != nil {
|
||||||
return errors.New("failed creating default admin account: " + err.Error())
|
return errors.New("failed creating default admin account: " + err.Error())
|
||||||
|
|
|
@ -116,7 +116,7 @@ CREATE TABLE DBPREFIXstaff(
|
||||||
CREATE TABLE DBPREFIXsessions(
|
CREATE TABLE DBPREFIXsessions(
|
||||||
id {serial pk},
|
id {serial pk},
|
||||||
staff_id {fk to serial} NOT NULL,
|
staff_id {fk to serial} NOT NULL,
|
||||||
expires TIMESTAMP NOT NULL,
|
expires TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
data VARCHAR(45) NOT NULL,
|
data VARCHAR(45) NOT NULL,
|
||||||
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -147,9 +147,9 @@ CREATE TABLE DBPREFIXip_ban(
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
ip VARCHAR(45) NOT NULL,
|
ip VARCHAR(45) NOT NULL,
|
||||||
issued_at TIMESTAMP NOT NULL,
|
issued_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
@ -165,8 +165,8 @@ CREATE TABLE DBPREFIXip_ban_audit(
|
||||||
staff_id {fk to serial} NOT NULL,
|
staff_id {fk to serial} NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
|
|
@ -116,7 +116,7 @@ CREATE TABLE DBPREFIXstaff(
|
||||||
CREATE TABLE DBPREFIXsessions(
|
CREATE TABLE DBPREFIXsessions(
|
||||||
id BIGINT NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
|
id BIGINT NOT NULL AUTO_INCREMENT UNIQUE PRIMARY KEY,
|
||||||
staff_id BIGINT NOT NULL,
|
staff_id BIGINT NOT NULL,
|
||||||
expires TIMESTAMP NOT NULL,
|
expires TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
data VARCHAR(45) NOT NULL,
|
data VARCHAR(45) NOT NULL,
|
||||||
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -147,9 +147,9 @@ CREATE TABLE DBPREFIXip_ban(
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
ip VARCHAR(45) NOT NULL,
|
ip VARCHAR(45) NOT NULL,
|
||||||
issued_at TIMESTAMP NOT NULL,
|
issued_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
@ -165,8 +165,8 @@ CREATE TABLE DBPREFIXip_ban_audit(
|
||||||
staff_id BIGINT NOT NULL,
|
staff_id BIGINT NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
|
|
@ -116,7 +116,7 @@ CREATE TABLE DBPREFIXstaff(
|
||||||
CREATE TABLE DBPREFIXsessions(
|
CREATE TABLE DBPREFIXsessions(
|
||||||
id BIGSERIAL PRIMARY KEY,
|
id BIGSERIAL PRIMARY KEY,
|
||||||
staff_id BIGINT NOT NULL,
|
staff_id BIGINT NOT NULL,
|
||||||
expires TIMESTAMP NOT NULL,
|
expires TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
data VARCHAR(45) NOT NULL,
|
data VARCHAR(45) NOT NULL,
|
||||||
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -147,9 +147,9 @@ CREATE TABLE DBPREFIXip_ban(
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
ip VARCHAR(45) NOT NULL,
|
ip VARCHAR(45) NOT NULL,
|
||||||
issued_at TIMESTAMP NOT NULL,
|
issued_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
@ -165,8 +165,8 @@ CREATE TABLE DBPREFIXip_ban_audit(
|
||||||
staff_id BIGINT NOT NULL,
|
staff_id BIGINT NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
|
|
@ -116,7 +116,7 @@ CREATE TABLE DBPREFIXstaff(
|
||||||
CREATE TABLE DBPREFIXsessions(
|
CREATE TABLE DBPREFIXsessions(
|
||||||
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
|
||||||
staff_id BIGINT NOT NULL,
|
staff_id BIGINT NOT NULL,
|
||||||
expires TIMESTAMP NOT NULL,
|
expires TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
data VARCHAR(45) NOT NULL,
|
data VARCHAR(45) NOT NULL,
|
||||||
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
CONSTRAINT sessions_staff_id_fk FOREIGN KEY(staff_id) REFERENCES DBPREFIXstaff(id) ON DELETE CASCADE
|
||||||
);
|
);
|
||||||
|
@ -147,9 +147,9 @@ CREATE TABLE DBPREFIXip_ban(
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
ip VARCHAR(45) NOT NULL,
|
ip VARCHAR(45) NOT NULL,
|
||||||
issued_at TIMESTAMP NOT NULL,
|
issued_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
@ -165,8 +165,8 @@ CREATE TABLE DBPREFIXip_ban_audit(
|
||||||
staff_id BIGINT NOT NULL,
|
staff_id BIGINT NOT NULL,
|
||||||
is_active BOOL NOT NULL,
|
is_active BOOL NOT NULL,
|
||||||
is_thread_ban BOOL NOT NULL,
|
is_thread_ban BOOL NOT NULL,
|
||||||
expires_at TIMESTAMP NOT NULL,
|
expires_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
appeal_at TIMESTAMP NOT NULL,
|
appeal_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
permanent BOOL NOT NULL,
|
permanent BOOL NOT NULL,
|
||||||
staff_note VARCHAR(255) NOT NULL,
|
staff_note VARCHAR(255) NOT NULL,
|
||||||
message TEXT NOT NULL,
|
message TEXT NOT NULL,
|
||||||
|
|
1
vagrant/Vagrantfile
vendored
1
vagrant/Vagrantfile
vendored
|
@ -31,6 +31,7 @@ Vagrant.configure("2") do |config|
|
||||||
config.vm.provision :shell, path: "bootstrap.sh", env: {
|
config.vm.provision :shell, path: "bootstrap.sh", env: {
|
||||||
:DBTYPE => DBTYPE,
|
:DBTYPE => DBTYPE,
|
||||||
:GOPATH => "/home/vagrant/go",
|
:GOPATH => "/home/vagrant/go",
|
||||||
|
:MYSQL_MAINLINE => ENV.fetch("GC_MYSQL_MAINLINE", ""),
|
||||||
:FROMDOCKER => ""
|
:FROMDOCKER => ""
|
||||||
}, args: "install"
|
}, args: "install"
|
||||||
end
|
end
|
||||||
|
|
|
@ -17,7 +17,13 @@ apt-get -y update && apt-get -y upgrade
|
||||||
|
|
||||||
if [ "$DBTYPE" == "mysql" ]; then
|
if [ "$DBTYPE" == "mysql" ]; then
|
||||||
# Using MySQL (stable)
|
# Using MySQL (stable)
|
||||||
apt-get -y install mariadb-server mariadb-client
|
if [ "$MYSQL_MAINLINE" == "1" ]; then
|
||||||
|
echo "using mainline MySQL instead of MariaDB"
|
||||||
|
apt-get -y install mysql-server mysql-client
|
||||||
|
else
|
||||||
|
echo "using MariaDB fork of MySQL (default)"
|
||||||
|
apt-get -y install mariadb-server mariadb-client
|
||||||
|
fi
|
||||||
mysql -uroot <<- EOF
|
mysql -uroot <<- EOF
|
||||||
CREATE DATABASE IF NOT EXISTS gochan;
|
CREATE DATABASE IF NOT EXISTS gochan;
|
||||||
GRANT USAGE ON *.* TO gochan IDENTIFIED BY 'gochan'; \
|
GRANT USAGE ON *.* TO gochan IDENTIFIED BY 'gochan'; \
|
||||||
|
@ -25,8 +31,13 @@ if [ "$DBTYPE" == "mysql" ]; then
|
||||||
SET PASSWORD FOR 'gochan'@'%' = PASSWORD('gochan');
|
SET PASSWORD FOR 'gochan'@'%' = PASSWORD('gochan');
|
||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
EOF
|
EOF
|
||||||
systemctl enable mariadb
|
if [ "$MYSQL_MAINLINE" == "1" ]; then
|
||||||
systemctl start mariadb &
|
systemctl enable mysql
|
||||||
|
systemctl start mysql &
|
||||||
|
else
|
||||||
|
systemctl enable mariadb
|
||||||
|
systemctl start mariadb &
|
||||||
|
fi
|
||||||
wait
|
wait
|
||||||
if [ -d /lib/systemd ]; then
|
if [ -d /lib/systemd ]; then
|
||||||
cp /vagrant/sample-configs/gochan-mysql.service /lib/systemd/system/gochan.service
|
cp /vagrant/sample-configs/gochan-mysql.service /lib/systemd/system/gochan.service
|
||||||
|
|
2
version
2
version
|
@ -1 +1 @@
|
||||||
3.5.0
|
3.5.1
|
Loading…
Add table
Add a link
Reference in a new issue