[PR #32090] chore: remove server_default from UUID columns in model definitions #33545

Closed
opened 2026-02-21 20:53:28 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/32090

State: closed
Merged: No


Summary

  • Remove server_default from UUID column definitions in TrialApp, AccountTrialAppRecord, and ExporleBanner models
  • Replace with default=lambda: str(uuid4()) to handle UUID generation at the application layer
  • Aligns these models with the existing convention used by all other models in the file

Motivation

As described in #29314, the server_default parameter with uuid_generate_v4() is PostgreSQL-specific and causes confusion for new model definitions. The application layer should handle database-agnostic UUID generation using Python uuid4(), which is the established pattern throughout the codebase.

Migration files are intentionally left unchanged as they reflect the actual database state at the time of creation.

Test plan

  • Verified all pre-commit checks pass (Ruff linter, ESLint, TypeScript type-check)
  • Confirmed uuid4 is already imported at the top of the file (from uuid import uuid4)
  • Confirmed the change follows the same pattern as other models in the same file (e.g., App, InstalledApp, RecommendedApp)

Closes #29314

**Original Pull Request:** https://github.com/langgenius/dify/pull/32090 **State:** closed **Merged:** No --- ## Summary - Remove server_default from UUID column definitions in TrialApp, AccountTrialAppRecord, and ExporleBanner models - Replace with default=lambda: str(uuid4()) to handle UUID generation at the application layer - Aligns these models with the existing convention used by all other models in the file ## Motivation As described in #29314, the server_default parameter with uuid_generate_v4() is PostgreSQL-specific and causes confusion for new model definitions. The application layer should handle database-agnostic UUID generation using Python uuid4(), which is the established pattern throughout the codebase. Migration files are intentionally left unchanged as they reflect the actual database state at the time of creation. ## Test plan - [x] Verified all pre-commit checks pass (Ruff linter, ESLint, TypeScript type-check) - [x] Confirmed uuid4 is already imported at the top of the file (from uuid import uuid4) - [x] Confirmed the change follows the same pattern as other models in the same file (e.g., App, InstalledApp, RecommendedApp) Closes #29314
yindo added the pull-request label 2026-02-21 20:53:28 -05:00
yindo closed this issue 2026-02-21 20:53:28 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#33545