mirror of
https://github.com/Eggbertx/gochan.git
synced 2025-08-01 22:26:24 -07:00
Put gochan's migration tool on indefinite hiatus.
RIP gochan-migrate :(
This commit is contained in:
parent
62a31e651e
commit
636fe77e01
3 changed files with 72 additions and 65 deletions
|
@ -22,7 +22,9 @@ See [config.md](config.md)
|
|||
See [`docker/README.md`](docker/README.md)
|
||||
|
||||
## Migration
|
||||
If you run gochan and get a message telling you your database is out of data, please run gochan-migration. If this does not work, please contact the developers.
|
||||
<s>If you run gochan and get a message telling you your database is out of data, please run gochan-migration. If this does not work, please contact the developers.</s>
|
||||
|
||||
gochan-migration has been a gargantuan time sink and has wasted a lot of time that would be much better spent working on other features, so I am putting its development on indefinite hiatus as of 12/18/2021. It may or may not come back, but for the time being, RIP gochan-migration, we hardly knew ya.
|
||||
|
||||
## For developers (using Vagrant)
|
||||
1. Install Vagrant and Virtualbox. Vagrant lets you create a virtual machine and run a custom setup/installation script to make installation easier and faster.
|
||||
|
@ -35,7 +37,7 @@ If you run gochan and get a message telling you your database is out of data, pl
|
|||
3. Set "DebugMode" to true. This will log all logs to the console and disable some checks.
|
||||
4. Open the folder containing everything in vscode (named gochan most likely), go to "Run"
|
||||
1. Select "gochan" if you wish to run/debug the website itself
|
||||
2. Select "gochan-migrate" if you wish to run/debug the migrator
|
||||
2. <s>Select "gochan-migrate" if you wish to run/debug the migrator</s> (gochan-migrate development has been put on indefinite hiatus)
|
||||
5. (Optional) Change go extention configs. Examples: save all files on start debugging
|
||||
6. Press F5 or "Start Debugging" to debug.
|
||||
|
||||
|
|
18
build.py
18
build.py
|
@ -158,11 +158,12 @@ def build(debugging = False):
|
|||
exit(1)
|
||||
print("Built gochan successfully\n")
|
||||
|
||||
status = run_cmd(build_cmd + " -o " + migration_exe + " ./cmd/gochan-migration", realtime = True, print_command = True)[1]
|
||||
if status != 0:
|
||||
print("Failed building gochan-migration, see command output for details")
|
||||
exit(1)
|
||||
print("Build gochan-migration successfully\n")
|
||||
print("Note: gochan-migration has been put on indefinite suspention. See README.md")
|
||||
# status = run_cmd(build_cmd + " -o " + migration_exe + " ./cmd/gochan-migration", realtime = True, print_command = True)[1]
|
||||
# if status != 0:
|
||||
# print("Failed building gochan-migration, see command output for details")
|
||||
# exit(1)
|
||||
# print("Build gochan-migration successfully\n")
|
||||
|
||||
def clean():
|
||||
print("Cleaning up")
|
||||
|
@ -212,8 +213,9 @@ def install(prefix = "/usr", document_root = "/srv/gochan"):
|
|||
build()
|
||||
print("Installing",gochan_exe,"to",path.join(prefix, "bin", gochan_exe))
|
||||
fs_action("copy", gochan_exe, path.join(prefix, "bin", gochan_exe))
|
||||
print("Installing",migration_exe,"to",path.join(prefix, "bin", migration_exe))
|
||||
fs_action("copy", migration_exe, path.join(prefix, "bin", migration_exe))
|
||||
print("Note: gochan-migration has been put on indefinite suspention. See README.md")
|
||||
# print("Installing",migration_exe,"to",path.join(prefix, "bin", migration_exe))
|
||||
# fs_action("copy", migration_exe, path.join(prefix, "bin", migration_exe))
|
||||
|
||||
|
||||
print(
|
||||
|
@ -257,7 +259,7 @@ def release(goos):
|
|||
handle = tarfile.open(release_dir + ".tar.gz", "w:gz")
|
||||
func = handle.add
|
||||
func(gochan_exe, path.join(release_name, gochan_exe))
|
||||
func(migration_exe, path.join(release_name, migration_exe))
|
||||
# func(migration_exe, path.join(release_name, migration_exe))
|
||||
for file in release_files:
|
||||
func(file, path.join(release_name, file))
|
||||
handle.close()
|
||||
|
|
|
@ -3,15 +3,11 @@ package main
|
|||
import (
|
||||
"bufio"
|
||||
"encoding/json"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
|
||||
"github.com/gochan-org/gochan/cmd/gochan-migration/internal/common"
|
||||
"github.com/gochan-org/gochan/cmd/gochan-migration/internal/kusabax"
|
||||
"github.com/gochan-org/gochan/cmd/gochan-migration/internal/pre2021"
|
||||
"github.com/gochan-org/gochan/cmd/gochan-migration/internal/tinyboard"
|
||||
|
||||
_ "github.com/go-sql-driver/mysql"
|
||||
_ "github.com/lib/pq"
|
||||
|
@ -48,62 +44,69 @@ func readConfig(filename string, options *common.DBOptions) {
|
|||
}
|
||||
|
||||
func main() {
|
||||
var options common.DBOptions
|
||||
var migrationConfigFile string
|
||||
fmt.Println(
|
||||
"gochan-migration has been a gargantuan time sink and has wasted a lot of time that would be much better",
|
||||
"spent working on other features, so I am putting its development on indefinite hiatus as of 12/18/2021.",
|
||||
"It may or may not come back, but for the time being, RIP gochan-migration, we hardly knew ya.",
|
||||
)
|
||||
os.Exit(1)
|
||||
|
||||
flag.StringVar(&migrationConfigFile, "migrationconfig", "", "a JSON file to use for supplying the required migration information (ignores all other set arguments if used)")
|
||||
flag.StringVar(&options.OldChanType, "oldchan", "", "The imageboard we are migrating from (currently only pre2021 is supported, but more are coming")
|
||||
flag.StringVar(&options.Host, "dbhost", "", "The database host or socket file to connect to")
|
||||
flag.StringVar(&options.DBType, "dbtype", "mysql", "The kind of database server we are connecting to (currently only mysql is supported)")
|
||||
flag.StringVar(&options.Username, "dbusername", "", "The database username")
|
||||
flag.StringVar(&options.Password, "dbpassword", "", "The database password (if required by SQL account)")
|
||||
flag.StringVar(&options.OldDBName, "olddbname", "", "The name of the old database")
|
||||
flag.StringVar(&options.NewDBName, "newdbname", "", "The name of the new database")
|
||||
flag.StringVar(&options.TablePrefix, "tableprefix", "", "Prefix for the SQL tables' names")
|
||||
flag.Parse()
|
||||
// var options common.DBOptions
|
||||
// var migrationConfigFile string
|
||||
|
||||
if migrationConfigFile != "" {
|
||||
readConfig(migrationConfigFile, &options)
|
||||
}
|
||||
// flag.StringVar(&migrationConfigFile, "migrationconfig", "", "a JSON file to use for supplying the required migration information (ignores all other set arguments if used)")
|
||||
// flag.StringVar(&options.OldChanType, "oldchan", "", "The imageboard we are migrating from (currently only pre2021 is supported, but more are coming")
|
||||
// flag.StringVar(&options.Host, "dbhost", "", "The database host or socket file to connect to")
|
||||
// flag.StringVar(&options.DBType, "dbtype", "mysql", "The kind of database server we are connecting to (currently only mysql is supported)")
|
||||
// flag.StringVar(&options.Username, "dbusername", "", "The database username")
|
||||
// flag.StringVar(&options.Password, "dbpassword", "", "The database password (if required by SQL account)")
|
||||
// flag.StringVar(&options.OldDBName, "olddbname", "", "The name of the old database")
|
||||
// flag.StringVar(&options.NewDBName, "newdbname", "", "The name of the new database")
|
||||
// flag.StringVar(&options.TablePrefix, "tableprefix", "", "Prefix for the SQL tables' names")
|
||||
// flag.Parse()
|
||||
|
||||
if options.OldChanType == "" || options.Host == "" || options.DBType == "" || options.Username == "" || options.OldDBName == "" || options.NewDBName == "" {
|
||||
flag.PrintDefaults()
|
||||
fmt.Println("Missing required database connection info")
|
||||
os.Exit(1)
|
||||
return
|
||||
}
|
||||
// if migrationConfigFile != "" {
|
||||
// readConfig(migrationConfigFile, &options)
|
||||
// }
|
||||
|
||||
fmt.Printf(banner, versionStr)
|
||||
// if options.OldChanType == "" || options.Host == "" || options.DBType == "" || options.Username == "" || options.OldDBName == "" || options.NewDBName == "" {
|
||||
// flag.PrintDefaults()
|
||||
// fmt.Println("Missing required database connection info")
|
||||
// os.Exit(1)
|
||||
// return
|
||||
// }
|
||||
|
||||
var migrator common.DBMigrator
|
||||
switch options.OldChanType {
|
||||
case "kusabax":
|
||||
migrator = &kusabax.KusabaXMigrator{}
|
||||
case "pre2021":
|
||||
migrator = &pre2021.Pre2021Migrator{}
|
||||
case "tinyboard":
|
||||
migrator = &tinyboard.TinyBoardMigrator{}
|
||||
default:
|
||||
fatalPrintln("Invalid oldchan value")
|
||||
}
|
||||
// fmt.Printf(banner, versionStr)
|
||||
|
||||
err := migrator.Init(options)
|
||||
if err != nil {
|
||||
fatalPrintln("Error initializing migrator:", err)
|
||||
}
|
||||
defer migrator.Close()
|
||||
// var migrator common.DBMigrator
|
||||
// switch options.OldChanType {
|
||||
// case "kusabax":
|
||||
// migrator = &kusabax.KusabaXMigrator{}
|
||||
// case "pre2021":
|
||||
// migrator = &pre2021.Pre2021Migrator{}
|
||||
// case "tinyboard":
|
||||
// migrator = &tinyboard.TinyBoardMigrator{}
|
||||
// default:
|
||||
// fatalPrintln("Invalid oldchan value")
|
||||
// }
|
||||
|
||||
// config.InitConfig(versionStr)
|
||||
/* gclog.Printf(gclog.LStdLog, "Starting gochan migration (gochan v%s)", versionStr)
|
||||
err := gcmigrate.Entry(1) //TEMP, get correct database version from command line or some kind of table. 1 Is the current version we are working towards
|
||||
if err != nil {
|
||||
gclog.Printf(gclog.LErrorLog, "Error while migrating: %s", err)
|
||||
} */
|
||||
if options.OldDBName == options.NewDBName {
|
||||
fatalPrintln("The old database name must not be the same as the new one.")
|
||||
}
|
||||
if err = migrator.MigrateDB(); err != nil {
|
||||
fatalPrintln(err)
|
||||
}
|
||||
fmt.Println("Database migration successful!")
|
||||
// err := migrator.Init(options)
|
||||
// if err != nil {
|
||||
// fatalPrintln("Error initializing migrator:", err)
|
||||
// }
|
||||
// defer migrator.Close()
|
||||
|
||||
// // config.InitConfig(versionStr)
|
||||
// /* gclog.Printf(gclog.LStdLog, "Starting gochan migration (gochan v%s)", versionStr)
|
||||
// err := gcmigrate.Entry(1) //TEMP, get correct database version from command line or some kind of table. 1 Is the current version we are working towards
|
||||
// if err != nil {
|
||||
// gclog.Printf(gclog.LErrorLog, "Error while migrating: %s", err)
|
||||
// } */
|
||||
// if options.OldDBName == options.NewDBName {
|
||||
// fatalPrintln("The old database name must not be the same as the new one.")
|
||||
// }
|
||||
// if err = migrator.MigrateDB(); err != nil {
|
||||
// fatalPrintln(err)
|
||||
// }
|
||||
// fmt.Println("Database migration successful!")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue