Skip to content

Commit c6170cd

Browse files
authored
updates init migration to include max_request_body_size column (#469)
## Summary Added a migration to add the `max_request_body_size_mb` column to the `TableClientConfig` table if it doesn't exist. ## Changes - Added a conditional check to verify if the `max_request_body_size_mb` column exists in the `TableClientConfig` table - Implemented logic to add the column if it doesn't exist - This allows for configuring maximum request body size limits per client ## Type of change - [x] Feature - [x] Chore/CI ## Affected areas - [x] Core (Go) ## How to test ```sh # Core/Transports go version go test ./framework/configstore/... # Verify migration runs successfully on database startup # Check that existing databases get the new column added ``` ## Breaking changes - [x] No ## Security considerations This change enhances security by allowing configuration of request body size limits, which can help prevent potential DoS attacks through oversized payloads. ## Checklist - [x] I added/updated tests where appropriate - [x] I verified builds succeed (Go and UI)
2 parents fdb5a1c + d41f684 commit c6170cd

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

framework/configstore/migrations.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ func migrationInit(db *gorm.DB) error {
5252
if err := migrator.CreateTable(&TableClientConfig{}); err != nil {
5353
return err
5454
}
55+
} else if !migrator.HasColumn(&TableClientConfig{}, "max_request_body_size_mb") {
56+
if err := migrator.AddColumn(&TableClientConfig{}, "max_request_body_size_mb"); err != nil {
57+
return err
58+
}
5559
}
5660
if !migrator.HasTable(&TableEnvKey{}) {
5761
if err := migrator.CreateTable(&TableEnvKey{}); err != nil {

0 commit comments

Comments
 (0)