fixed bug with creating image results table

This commit is contained in:
Ross Trottier 2024-05-24 20:12:40 -06:00
parent 48ff48884b
commit cd8ac17775

34
main.go
View File

@ -15,7 +15,7 @@ const wordpressSecret = "6zY7 xsKZ dGIt l1Lp ypIK 6TWh"
const slowtwitchAdminUser = "admin"
const slowtwitchAdminPass = "yxnh93Ybbz2Nm8#mp28zCVv"
const slowtwitchDbName = "slowtwitch"
const migrationDbName = "slowtwitch_transfer"
const migrationDbName = "slowtwitch_transfer_threaded_test"
const federatedDbUrl = "slowtwitch.northend.network"
const federatedDbPort = "3306"
@ -72,22 +72,6 @@ func connectToDatabases() {
panic("Could not create category results table.")
}
createImageResultsTableSQL := `
create table if not exists ImageResults(
Id int primary key not null auto_increment,
PostId int null,
WordpressId int not null,
OldUrl nvarchar(500) not null,
NewUrl nvarchar(500),
IsSuccess BIT not null,
ErrorMessage nvarchar(1500),
foreign key (PostId) references PostResults(Id)
);`
_, createImageResultsTableErr := resultsDB.Exec(createImageResultsTableSQL)
if createImageResultsTableErr != nil {
panic("Could not create image results table.")
}
createPostsResultsTableSQL := `
create table if not exists PostResults(
Id int primary key not null auto_increment,
@ -103,6 +87,22 @@ func connectToDatabases() {
if createPostsResultsTableErr != nil {
panic("Could not create post results table.")
}
createImageResultsTableSQL := `
create table if not exists ImageResults(
Id int primary key not null auto_increment,
PostId int null,
WordpressId int not null,
OldUrl nvarchar(500) not null,
NewUrl nvarchar(500),
IsSuccess BIT not null,
ErrorMessage nvarchar(1500),
foreign key (PostId) references PostResults(Id)
);`
_, createImageResultsTableErr := resultsDB.Exec(createImageResultsTableSQL)
if createImageResultsTableErr != nil {
panic("Could not create image results table.")
}
}
func migrateAuthors() {