Skip to content

fix: Migrate secret_value column to be TEXT#189

Open
yuechao-qin wants to merge 1 commit intomasterfrom
ycq/fix-migrate-secret-to-text
Open

fix: Migrate secret_value column to be TEXT#189
yuechao-qin wants to merge 1 commit intomasterfrom
ycq/fix-migrate-secret-to-text

Conversation

@yuechao-qin
Copy link
Copy Markdown
Collaborator

@yuechao-qin yuechao-qin commented Mar 27, 2026

TL;DR

Changed the secret_value column in the Secret table from VARCHAR to TEXT type to support longer secret values, with a database migration to handle existing deployments.

What changed?

  • Modified the Secret model's secret_value field to use sql.Text() instead of the default string type
  • Added migrate_secret_value_column() function that performs dialect-aware column type migration for MySQL, PostgreSQL, and SQLite
  • Integrated the migration into the main migrate_db() function to run automatically during database migrations
  • The migration is idempotent and skips execution if the column is already TEXT type

How to test?

uv run pytest tests/test_database_migrations.py

Why make this change?

The previous VARCHAR column type had length limitations that could prevent storing longer secret values. Using TEXT type removes these constraints while maintaining compatibility across different database dialects. The migration ensures existing deployments can upgrade seamlessly without manual intervention.

Copy link
Copy Markdown
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@yuechao-qin yuechao-qin force-pushed the ycq/fix-migrate-secret-to-text branch from 7438c21 to 9feb053 Compare March 27, 2026 23:10
@yuechao-qin yuechao-qin force-pushed the ycq/fix-migrate-secret-to-text branch from 9feb053 to e0ac2d6 Compare March 27, 2026 23:13
@yuechao-qin yuechao-qin marked this pull request as ready for review March 27, 2026 23:20
@yuechao-qin yuechao-qin requested a review from Ark-kun as a code owner March 27, 2026 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant