Skip to content

Modern Docker Management, Designed for Everyone

fix: change notification logs to TEXT instead of VARCHAR(255) (#1779)

Kyle Mendell7e0735e25f9a
diff --git a/backend/internal/models/notification.go b/backend/internal/models/notification.go
index e7a1339f8..daba2d169 100644
--- a/backend/internal/models/notification.go
+++ b/backend/internal/models/notification.go
@@ -70,7 +70,7 @@ func (NotificationSettings) TableName() string {
type NotificationLog struct {
ID uint `json:"id" gorm:"primaryKey"`
Provider NotificationProvider `json:"provider" gorm:"not null;index;type:varchar(50)"`
- ImageRef string `json:"imageRef" gorm:"not null"`
+ ImageRef string `json:"imageRef" gorm:"not null;type:text"`
Status string `json:"status" gorm:"not null"`
Error *string `json:"error,omitempty"`
Metadata JSON `json:"metadata" gorm:"type:jsonb"`
diff --git a/backend/resources/migrations/postgres/036_notification_log_image_ref_text.down.sql b/backend/resources/migrations/postgres/036_notification_log_image_ref_text.down.sql
new file mode 100644
index 000000000..edf194a2b
--- /dev/null
+++ b/backend/resources/migrations/postgres/036_notification_log_image_ref_text.down.sql
@@ -0,0 +1,2 @@
+-- Revert image_ref back to VARCHAR(255)
+ALTER TABLE notification_logs ALTER COLUMN image_ref TYPE VARCHAR(255);
diff --git a/backend/resources/migrations/postgres/036_notification_log_image_ref_text.up.sql b/backend/resources/migrations/postgres/036_notification_log_image_ref_text.up.sql
new file mode 100644
index 000000000..c9dbc1135
--- /dev/null
+++ b/backend/resources/migrations/postgres/036_notification_log_image_ref_text.up.sql
@@ -0,0 +1,2 @@
+-- Change image_ref from VARCHAR(255) to TEXT to support batch notifications with multiple image refs
+ALTER TABLE notification_logs ALTER COLUMN image_ref TYPE TEXT;
diff --git a/backend/resources/migrations/sqlite/036_notification_log_image_ref_text.down.sql b/backend/resources/migrations/sqlite/036_notification_log_image_ref_text.down.sql
new file mode 100644
index 000000000..2a3d4cf32
--- /dev/null
+++ b/backend/resources/migrations/sqlite/036_notification_log_image_ref_text.down.sql
@@ -0,0 +1 @@
+-- No-op: SQLite doesn't enforce VARCHAR length constraints
diff --git a/backend/resources/migrations/sqlite/036_notification_log_image_ref_text.up.sql b/backend/resources/migrations/sqlite/036_notification_log_image_ref_text.up.sql
new file mode 100644
index 000000000..bc12684af
--- /dev/null
+++ b/backend/resources/migrations/sqlite/036_notification_log_image_ref_text.up.sql
@@ -0,0 +1,3 @@
+-- SQLite doesn't enforce VARCHAR length, but we recreate the table for consistency
+-- SQLite treats VARCHAR(255) and TEXT the same, so this is a no-op for existing data
+-- but documents the intended schema change