[PR #22288] minor fix: fix default for status of TidbAuthBinding in compatible with various versions #29887

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

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

State: closed
Merged: Yes


Important

  1. Make sure you have read our contribution guidelines
  2. Ensure there is an associated issue and you have been assigned to it
  3. Use the correct syntax to link this PR: Fixes #<issue number>.

Summary

This PR fixes the default value for the status column in the TidbAuthBinding model to ensure PostgreSQL compatibility. The change updates the server default from "CREATING" to "'CREATING'::character varying" to properly cast the string literal as a character varying type in PostgreSQL.

Changes made:

  • Updated TidbAuthBinding.status column default value to use proper PostgreSQL syntax
  • Added explicit type casting ::character varying to ensure database compatibility
  • This prevents potential SQL errors when creating new TidbAuthBinding records

Motivation:
The previous default value syntax "CREATING" was causing compatibility issues with PostgreSQL databases. PostgreSQL requires explicit type casting for string literals in column defaults, hence the need for 'CREATING'::character varying syntax.

Screenshots

Before After
server_default=db.text("CREATING") server_default=db.text("'CREATING'::character varying")

Checklist

  • This change requires a documentation update, included: Dify Document
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Additional Notes

  • This is a database schema compatibility fix
  • The change only affects the default value generation and doesn't impact existing data
  • Tested with PostgreSQL to ensure the new syntax works correctly
  • No breaking changes introduced
**Original Pull Request:** https://github.com/langgenius/dify/pull/22288 **State:** closed **Merged:** Yes --- > [!IMPORTANT] > > 1. Make sure you have read our [contribution guidelines](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) > 2. Ensure there is an associated issue and you have been assigned to it > 3. Use the correct syntax to link this PR: `Fixes #<issue number>`. ## Summary This PR fixes the default value for the `status` column in the `TidbAuthBinding` model to ensure PostgreSQL compatibility. The change updates the server default from `"CREATING"` to `"'CREATING'::character varying"` to properly cast the string literal as a character varying type in PostgreSQL. **Changes made:** - Updated `TidbAuthBinding.status` column default value to use proper PostgreSQL syntax - Added explicit type casting `::character varying` to ensure database compatibility - This prevents potential SQL errors when creating new TidbAuthBinding records **Motivation:** The previous default value syntax `"CREATING"` was causing compatibility issues with PostgreSQL databases. PostgreSQL requires explicit type casting for string literals in column defaults, hence the need for `'CREATING'::character varying` syntax. ## Screenshots | Before | After | |--------|-------| | `server_default=db.text("CREATING")` | `server_default=db.text("'CREATING'::character varying")` | ## Checklist - [ ] This change requires a documentation update, included: [Dify Document](https://github.com/langgenius/dify-docs) - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [x] I've updated the documentation accordingly. - [x] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods ## Additional Notes - This is a database schema compatibility fix - The change only affects the default value generation and doesn't impact existing data - Tested with PostgreSQL to ensure the new syntax works correctly - No breaking changes introduced
yindo added the pull-request label 2026-02-21 20:46:26 -05:00
yindo closed this issue 2026-02-21 20:46:26 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#29887