summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorLibravatar tobi <tobi.smethurst@protonmail.com>2025-06-13 16:05:00 +0200
committerLibravatar tobi <kipvandenbos@noreply.codeberg.org>2025-06-13 16:05:00 +0200
commit726584287a721d22a0287e62a37e14c81e01b454 (patch)
treec4e054a06b82bf00ca3b4b4d5980b043ea62fe30 /internal
parent[chore] upgrade golangci-lint to v2.1.6 and migrate config (#4265) (diff)
downloadgotosocial-726584287a721d22a0287e62a37e14c81e01b454.tar.xz
[bugfix] Remove hardcoded "public" db schema assumption (#4269)
This pull request closes https://codeberg.org/superseriousbusiness/gotosocial/issues/4257 by removing the hardcoded "public" schema assumption in the database migrations. Tested on a local postgres with both the default public schema, and with the connection string (gotosocial schema) mentioned in the issue. Both seem to work OK! Reviewed-on: https://codeberg.org/superseriousbusiness/gotosocial/pulls/4269 Co-authored-by: tobi <tobi.smethurst@protonmail.com> Co-committed-by: tobi <tobi.smethurst@protonmail.com>
Diffstat (limited to 'internal')
-rw-r--r--internal/db/bundb/migrations/20231128140847_remove_duplicate_indices.go26
-rw-r--r--internal/db/bundb/migrations/20240114112637_postgres_header_filter_fix.go4
-rw-r--r--internal/db/bundb/migrations/20241018151036_filter_unique_fix.go2
-rw-r--r--internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go4
4 files changed, 18 insertions, 18 deletions
diff --git a/internal/db/bundb/migrations/20231128140847_remove_duplicate_indices.go b/internal/db/bundb/migrations/20231128140847_remove_duplicate_indices.go
index 486a42229..b51731b0d 100644
--- a/internal/db/bundb/migrations/20231128140847_remove_duplicate_indices.go
+++ b/internal/db/bundb/migrations/20231128140847_remove_duplicate_indices.go
@@ -48,79 +48,79 @@ func init() {
{
old: "new_accounts_pkey",
new: "accounts_pkey",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"id"},
},
{
old: "new_accounts_uri_key",
new: "accounts_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"uri"},
},
{
old: "new_accounts_url_key",
new: "accounts_url_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"url"},
},
{
old: "new_accounts_inbox_uri_key",
new: "accounts_inbox_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"inbox_uri"},
},
{
old: "new_accounts_outbox_uri_key",
new: "accounts_outbox_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"outbox_uri"},
},
{
old: "new_accounts_following_uri_key",
new: "accounts_following_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"following_uri"},
},
{
old: "new_accounts_followers_uri_key",
new: "accounts_followers_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"followers_uri"},
},
{
old: "new_accounts_featured_collection_uri_key",
new: "accounts_featured_collection_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"featured_collection_uri"},
},
{
old: "new_accounts_public_key_uri_key",
new: "accounts_public_key_uri_key",
- table: "public.accounts",
+ table: "accounts",
columns: []string{"public_key_uri"},
},
{
old: "new_emojis_pkey1",
new: "emojis_pkey",
- table: "public.emojis",
+ table: "emojis",
columns: []string{"id"},
},
{
old: "new_emojis_uri_key1",
new: "emojis_uri_key",
- table: "public.emojis",
+ table: "emojis",
columns: []string{"uri"},
},
{
old: "new_status_faves_pkey",
new: "status_faves_pkey",
- table: "public.status_faves",
+ table: "status_faves",
columns: []string{"id"},
},
{
old: "new_status_faves_uri_key",
new: "status_faves_uri_key",
- table: "public.status_faves",
+ table: "status_faves",
columns: []string{"uri"},
},
} {
diff --git a/internal/db/bundb/migrations/20240114112637_postgres_header_filter_fix.go b/internal/db/bundb/migrations/20240114112637_postgres_header_filter_fix.go
index 29a442196..b6fc8c777 100644
--- a/internal/db/bundb/migrations/20240114112637_postgres_header_filter_fix.go
+++ b/internal/db/bundb/migrations/20240114112637_postgres_header_filter_fix.go
@@ -86,8 +86,8 @@ func init() {
// query from running.
if db.Dialect().Name() == dialect.PG {
for _, table := range []string{
- "public.header_filter_allows",
- "public.header_filter_blocks",
+ "header_filter_allows",
+ "header_filter_blocks",
} {
// Just swallow any errors
// here, we're not bothered.
diff --git a/internal/db/bundb/migrations/20241018151036_filter_unique_fix.go b/internal/db/bundb/migrations/20241018151036_filter_unique_fix.go
index c8fc7ecb2..a1eb700a7 100644
--- a/internal/db/bundb/migrations/20241018151036_filter_unique_fix.go
+++ b/internal/db/bundb/migrations/20241018151036_filter_unique_fix.go
@@ -107,7 +107,7 @@ func init() {
if _, err := tx.ExecContext(
ctx,
"ALTER TABLE ? RENAME CONSTRAINT ? TO ?",
- bun.Ident("public.filters"),
+ bun.Ident("filters"),
bun.Safe("new_filters_pkey"),
bun.Safe("filters_pkey"),
); err != nil {
diff --git a/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go b/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go
index 7be070bee..2b38e98d5 100644
--- a/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go
+++ b/internal/db/bundb/migrations/20250321131230_relax_account_uri_uniqueness.go
@@ -379,7 +379,7 @@ func init() {
if _, err := tx.ExecContext(
ctx,
"ALTER TABLE ? DROP CONSTRAINT IF EXISTS ?",
- bun.Ident("public.accounts"),
+ bun.Ident("accounts"),
bun.Safe(spec.old),
); err != nil {
return err
@@ -388,7 +388,7 @@ func init() {
if _, err := tx.ExecContext(
ctx,
"ALTER TABLE ? ADD CONSTRAINT ? UNIQUE(?)",
- bun.Ident("public.accounts"),
+ bun.Ident("accounts"),
bun.Safe(spec.new),
bun.Safe(strings.Join(spec.columns, ",")),
); err != nil {