Commit 78efa680 authored by Johnny's avatar Johnny

feat(store): change default storage type to local filesystem

Add migration scripts for existing instances without a storage setting
to explicitly preserve DATABASE as their storage type, ensuring backward
compatibility. Change the default for new installations to LOCAL to
improve out-of-the-box performance.
parent 026ea92f
......@@ -169,7 +169,7 @@ func (s *Store) GetInstanceMemoRelatedSetting(ctx context.Context) (*storepb.Ins
}
const (
defaultInstanceStorageType = storepb.InstanceStorageSetting_DATABASE
defaultInstanceStorageType = storepb.InstanceStorageSetting_LOCAL
defaultInstanceUploadSizeLimitMb = 30
defaultInstanceFilepathTemplate = "assets/{timestamp}_{filename}"
)
......
-- Set storage type to DATABASE for existing instances that have no storage setting configured.
-- This preserves backward-compatible behavior before the default was changed to LOCAL.
INSERT INTO system_setting (name, value, description)
SELECT 'STORAGE', '{"storageType":"DATABASE"}', ''
FROM DUAL
WHERE NOT EXISTS (SELECT 1 FROM system_setting WHERE name = 'STORAGE');
-- Set storage type to DATABASE for existing instances that have no storage setting configured.
-- This preserves backward-compatible behavior before the default was changed to LOCAL.
INSERT INTO system_setting (name, value, description)
SELECT 'STORAGE', '{"storageType":"DATABASE"}', ''
WHERE NOT EXISTS (SELECT 1 FROM system_setting WHERE name = 'STORAGE');
-- Set storage type to DATABASE for existing instances that have no storage setting configured.
-- This preserves backward-compatible behavior before the default was changed to LOCAL.
INSERT INTO system_setting (name, value, description)
SELECT 'STORAGE', '{"storageType":"DATABASE"}', ''
WHERE NOT EXISTS (SELECT 1 FROM system_setting WHERE name = 'STORAGE');
......@@ -193,7 +193,7 @@ func TestInstanceSettingStorageSetting(t *testing.T) {
storageSetting, err := ts.GetInstanceStorageSetting(ctx)
require.NoError(t, err)
require.NotNil(t, storageSetting)
require.Equal(t, storepb.InstanceStorageSetting_DATABASE, storageSetting.StorageType)
require.Equal(t, storepb.InstanceStorageSetting_LOCAL, storageSetting.StorageType)
require.Equal(t, int64(30), storageSetting.UploadSizeLimitMb)
require.Equal(t, "assets/{timestamp}_{filename}", storageSetting.FilepathTemplate)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment