mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2024-12-18 16:31:06 +00:00
[chore] Log during potentially long migrations (#3613)
* [chore] Log during potentially long migrations * remove unneeded log lines
This commit is contained in:
parent
d9e722dea3
commit
acdd495c70
|
@ -21,6 +21,7 @@
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||||
|
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||||
"github.com/uptrace/bun"
|
"github.com/uptrace/bun"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove 'updated_at' column.
|
// Remove 'updated_at' column.
|
||||||
|
log.Info(ctx, "removing unused updated_at column from mentions to save space, please wait...")
|
||||||
_, err = tx.NewDropColumn().
|
_, err = tx.NewDropColumn().
|
||||||
Model((*gtsmodel.Mention)(nil)).
|
Model((*gtsmodel.Mention)(nil)).
|
||||||
Column("updated_at").
|
Column("updated_at").
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20241113152126_add_status_edits"
|
gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20241113152126_add_status_edits"
|
||||||
|
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||||
|
|
||||||
"github.com/uptrace/bun"
|
"github.com/uptrace/bun"
|
||||||
)
|
)
|
||||||
|
@ -38,6 +39,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add EditIDs column to Status table.
|
// Add EditIDs column to Status table.
|
||||||
|
log.Info(ctx, "adding edits column to statuses table...")
|
||||||
_, err = tx.NewAddColumn().
|
_, err = tx.NewAddColumn().
|
||||||
Model((*gtsmodel.Status)(nil)).
|
Model((*gtsmodel.Status)(nil)).
|
||||||
ColumnExpr(colDef).
|
ColumnExpr(colDef).
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
|
|
||||||
old_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20241121121623_enum_strings_to_ints"
|
old_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/db/bundb/migrations/20241121121623_enum_strings_to_ints"
|
||||||
new_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
new_gtsmodel "github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||||
|
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/util"
|
"github.com/superseriousbusiness/gotosocial/internal/util"
|
||||||
|
|
||||||
"github.com/uptrace/bun"
|
"github.com/uptrace/bun"
|
||||||
|
@ -68,7 +69,9 @@ func init() {
|
||||||
|
|
||||||
// Before making changes to the visibility col
|
// Before making changes to the visibility col
|
||||||
// we must drop all indices that rely on it.
|
// we must drop all indices that rely on it.
|
||||||
|
log.Info(ctx, "dropping old visibility indexes...")
|
||||||
for _, index := range visIndices {
|
for _, index := range visIndices {
|
||||||
|
log.Info(ctx, "dropping old index %s...", index.name)
|
||||||
if _, err := tx.NewDropIndex().
|
if _, err := tx.NewDropIndex().
|
||||||
Index(index.name).
|
Index(index.name).
|
||||||
Exec(ctx); err != nil {
|
Exec(ctx); err != nil {
|
||||||
|
@ -88,7 +91,9 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recreate the visibility indices.
|
// Recreate the visibility indices.
|
||||||
|
log.Info(ctx, "creating new visibility indexes...")
|
||||||
for _, index := range visIndices {
|
for _, index := range visIndices {
|
||||||
|
log.Info(ctx, "creating new index %s...", index.name)
|
||||||
q := tx.NewCreateIndex().
|
q := tx.NewCreateIndex().
|
||||||
Table("statuses").
|
Table("statuses").
|
||||||
Index(index.name).
|
Index(index.name).
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
"github.com/superseriousbusiness/gotosocial/internal/gtsmodel"
|
||||||
|
"github.com/superseriousbusiness/gotosocial/internal/log"
|
||||||
"github.com/uptrace/bun"
|
"github.com/uptrace/bun"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -37,6 +38,7 @@ func init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove 'updated_at' column.
|
// Remove 'updated_at' column.
|
||||||
|
log.Info(ctx, "removing unused updated_at column from media attachments to save space, please wait...")
|
||||||
_, err = tx.NewDropColumn().
|
_, err = tx.NewDropColumn().
|
||||||
Model((*gtsmodel.MediaAttachment)(nil)).
|
Model((*gtsmodel.MediaAttachment)(nil)).
|
||||||
Column("updated_at").
|
Column("updated_at").
|
||||||
|
|
Loading…
Reference in a new issue