2024-05-07 22:03:15 +00:00
|
|
|
package main
|
|
|
|
|
2024-05-10 20:01:05 +00:00
|
|
|
import (
|
2024-05-16 16:26:59 +00:00
|
|
|
"federated.computer/wp-sync-slowtwitch/services/migration"
|
2024-05-10 20:01:05 +00:00
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2024-05-16 18:50:53 +00:00
|
|
|
const baseUrl = "https://slowtwitch.cloud/"
|
2024-05-16 16:26:59 +00:00
|
|
|
const wordpressKey = "admin@slowtwitch.cloud"
|
|
|
|
const wordpressSecret = "6zY7 xsKZ dGIt l1Lp ypIK 6TWh"
|
2024-05-07 22:03:15 +00:00
|
|
|
|
2024-05-14 21:59:04 +00:00
|
|
|
const slowtwitchAdminUser = "admin"
|
|
|
|
const slowtwitchAdminPass = "yxnh93Ybbz2Nm8#mp28zCVv"
|
|
|
|
const slowtwitchDbName = "slowtwitch"
|
2024-05-15 23:37:42 +00:00
|
|
|
const migrationDbName = "slowtwitch_transfer"
|
|
|
|
const federatedDbUrl = "slowtwitch.northend.network"
|
|
|
|
const federatedDbPort = "3306"
|
2024-05-14 21:59:04 +00:00
|
|
|
|
2024-05-07 22:03:15 +00:00
|
|
|
var appCache AppCache
|
|
|
|
|
|
|
|
func main() {
|
2024-05-15 23:37:42 +00:00
|
|
|
// TODO Category migration
|
|
|
|
// TODO User migration
|
|
|
|
// TODO Article migration
|
2024-05-16 16:26:59 +00:00
|
|
|
slowtwitchDB, slowtwitchDbErr := migration.Connect(slowtwitchAdminUser, slowtwitchAdminPass, federatedDbUrl, federatedDbPort, slowtwitchDbName)
|
|
|
|
if slowtwitchDbErr != nil {
|
|
|
|
fmt.Println(slowtwitchDbErr)
|
|
|
|
}
|
|
|
|
resultsDB, resultsDBerr := migration.Connect(slowtwitchAdminUser, slowtwitchAdminPass, federatedDbUrl, federatedDbPort, migrationDbName)
|
|
|
|
if resultsDBerr != nil {
|
|
|
|
fmt.Println(resultsDBerr)
|
2024-05-10 20:01:05 +00:00
|
|
|
}
|
|
|
|
|
2024-05-16 19:48:39 +00:00
|
|
|
editorMigration := migration.MigrateAuthors{
|
|
|
|
SlowtwitchDatabase: slowtwitchDB,
|
|
|
|
ResultsDatabase: resultsDB,
|
|
|
|
WordpressBaseUrl: baseUrl,
|
|
|
|
WordpressUser: wordpressKey,
|
|
|
|
WordpressPassword: wordpressSecret,
|
|
|
|
}
|
|
|
|
editorMigration.Execute()
|
2024-05-16 16:26:59 +00:00
|
|
|
categoryMigration := migration.MigrateCategories{
|
|
|
|
SlowtwitchDatabase: slowtwitchDB,
|
|
|
|
ResultsDatabase: resultsDB,
|
|
|
|
WordpressBaseUrl: baseUrl,
|
|
|
|
WordpressUser: wordpressKey,
|
|
|
|
WordpressPassword: wordpressSecret,
|
2024-05-14 21:59:04 +00:00
|
|
|
}
|
2024-05-16 16:26:59 +00:00
|
|
|
categoryMigration.Execute()
|
2024-05-10 20:01:05 +00:00
|
|
|
}
|