From 1a8310f027c18f4040bd9bd603ec027907d19714 Mon Sep 17 00:00:00 2001 From: boojack Date: Mon, 15 May 2023 22:59:26 +0800 Subject: [PATCH] chore: update system setting default value (#1665) --- server/resource.go | 2 +- server/system.go | 4 ++-- .../migration/prod/0.12/05__default_local_storage_path.sql | 7 ------- store/db/seed/10005__system_setting.sql | 5 ----- store/db/seed/{10006__tag.sql => 10005__tag.sql} | 0 5 files changed, 3 insertions(+), 15 deletions(-) delete mode 100644 store/db/migration/prod/0.12/05__default_local_storage_path.sql delete mode 100644 store/db/seed/10005__system_setting.sql rename store/db/seed/{10006__tag.sql => 10005__tag.sql} (100%) diff --git a/server/resource.go b/server/resource.go index fe3f908e..240750f7 100644 --- a/server/resource.go +++ b/server/resource.go @@ -137,7 +137,7 @@ func (s *Server) registerResourceRoutes(g *echo.Group) { if err != nil && common.ErrorCode(err) != common.NotFound { return echo.NewHTTPError(http.StatusInternalServerError, "Failed to find local storage path setting").SetInternal(err) } - localStoragePath := "" + localStoragePath := "assets/{timestamp}_{filename}" if systemSettingLocalStoragePath != nil { err = json.Unmarshal([]byte(systemSettingLocalStoragePath.Value), &localStoragePath) if err != nil { diff --git a/server/system.go b/server/system.go index c98d2bd2..fd852fd8 100644 --- a/server/system.go +++ b/server/system.go @@ -44,7 +44,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) { AllowSignUp: false, IgnoreUpgrade: false, DisablePublicMemos: false, - MaxUploadSizeMiB: 32, // this is the frontend default value + MaxUploadSizeMiB: 32, AdditionalStyle: "", AdditionalScript: "", CustomizedProfile: api.CustomizedProfile{ @@ -56,7 +56,7 @@ func (s *Server) registerSystemRoutes(g *echo.Group) { ExternalURL: "", }, StorageServiceID: api.DatabaseStorage, - LocalStoragePath: "", + LocalStoragePath: "assets/{timestamp}_{filename}", } systemSettingList, err := s.Store.FindSystemSettingList(ctx, &api.SystemSettingFind{}) diff --git a/store/db/migration/prod/0.12/05__default_local_storage_path.sql b/store/db/migration/prod/0.12/05__default_local_storage_path.sql deleted file mode 100644 index 71908e84..00000000 --- a/store/db/migration/prod/0.12/05__default_local_storage_path.sql +++ /dev/null @@ -1,7 +0,0 @@ -INSERT - OR IGNORE INTO system_setting(name, value) -VALUES - ( - 'local-storage-path', - '"assets/{timestamp}_{filename}"' - ); \ No newline at end of file diff --git a/store/db/seed/10005__system_setting.sql b/store/db/seed/10005__system_setting.sql deleted file mode 100644 index 145a8acc..00000000 --- a/store/db/seed/10005__system_setting.sql +++ /dev/null @@ -1,5 +0,0 @@ -INSERT INTO - system_setting (`name`, `value`, `description`) -VALUES - ('allow-signup', 'true', ''), - ('max-upload-size-mib', '32', ''); \ No newline at end of file diff --git a/store/db/seed/10006__tag.sql b/store/db/seed/10005__tag.sql similarity index 100% rename from store/db/seed/10006__tag.sql rename to store/db/seed/10005__tag.sql