diff options
author | 2024-10-11 15:21:45 +0200 | |
---|---|---|
committer | 2024-10-11 15:21:45 +0200 | |
commit | cb9008fb412e75e6ec8c2f5970fb5530aed7bb3a (patch) | |
tree | e89c23564a7c171ca6cbf254e6e3efe767157947 /internal/db/bundb/migrations/20240620074530_interaction_policy.go | |
parent | [chore] Create modernc sqlite builds alongside default wasm; add openbsd buil... (diff) | |
download | gotosocial-cb9008fb412e75e6ec8c2f5970fb5530aed7bb3a.tar.xz |
[bugfix] Ensure `pending_approval` set on statuses + status faves (#3415)
* [bugfix] Ensure pending_approval set on statuses + status faves
* set PendingApproval on boosts
* assume not pending approval
Diffstat (limited to 'internal/db/bundb/migrations/20240620074530_interaction_policy.go')
-rw-r--r-- | internal/db/bundb/migrations/20240620074530_interaction_policy.go | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/internal/db/bundb/migrations/20240620074530_interaction_policy.go b/internal/db/bundb/migrations/20240620074530_interaction_policy.go index e45db9382..bbc75d9ec 100644 --- a/internal/db/bundb/migrations/20240620074530_interaction_policy.go +++ b/internal/db/bundb/migrations/20240620074530_interaction_policy.go @@ -40,7 +40,7 @@ func init() { table string column string columnType string - defaultVal string + extra string } for _, spec := range []spec{ // Statuses. @@ -48,19 +48,19 @@ func init() { table: "statuses", column: "interaction_policy", columnType: "JSONB", - defaultVal: "", + extra: "", }, { table: "statuses", column: "pending_approval", columnType: "BOOLEAN", - defaultVal: "DEFAULT false", + extra: "NOT NULL DEFAULT false", }, { table: "statuses", column: "approved_by_uri", columnType: "varchar", - defaultVal: "", + extra: "", }, // Status faves. @@ -68,13 +68,13 @@ func init() { table: "status_faves", column: "pending_approval", columnType: "BOOLEAN", - defaultVal: "DEFAULT false", + extra: "NOT NULL DEFAULT false", }, { table: "status_faves", column: "approved_by_uri", columnType: "varchar", - defaultVal: "", + extra: "", }, // Columns that must be added to the @@ -85,31 +85,31 @@ func init() { table: "account_settings", column: "interaction_policy_direct", columnType: "JSONB", - defaultVal: "", + extra: "", }, { table: "account_settings", column: "interaction_policy_mutuals_only", columnType: "JSONB", - defaultVal: "", + extra: "", }, { table: "account_settings", column: "interaction_policy_followers_only", columnType: "JSONB", - defaultVal: "", + extra: "", }, { table: "account_settings", column: "interaction_policy_unlocked", columnType: "JSONB", - defaultVal: "", + extra: "", }, { table: "account_settings", column: "interaction_policy_public", columnType: "JSONB", - defaultVal: "", + extra: "", }, } { exists, err := doesColumnExist(ctx, tx, @@ -130,9 +130,9 @@ func init() { } qStr := "ALTER TABLE ? ADD COLUMN ? ?" - if spec.defaultVal != "" { + if spec.extra != "" { qStr += " ?" - args = append(args, bun.Safe(spec.defaultVal)) + args = append(args, bun.Safe(spec.extra)) } log.Infof(ctx, "adding column '%s' to '%s'...", spec.column, spec.table) |