tududi/backend/migrations/20260413000001-ensure-unlimited-text-fields.js
Chris 0265f6e70c
fix: prevent task name truncation when creating from inbox (#1020)
* fix: prevent Telegram polling errors from blocking container startup (#989)

This fix addresses the issue where the container gets stuck in an endless
loop of Telegram connection errors when the bot is configured but Telegram
is unreachable during startup.

Changes:
- Add 10-second startup delay before initializing Telegram polling to allow
  the system to settle
- Implement exponential backoff (5s to 5min) when Telegram connection fails
- Add rate-limited error logging (max once per minute per user) to reduce
  log spam and prevent event loop blocking
- Track error state per user to manage backoff independently
- Auto-reset error state on successful connection
- Update tests to account for new error state tracking

Fixes #989

* fix: prevent task name truncation when creating from inbox

Changes:
- Change task.name from VARCHAR(255) to TEXT to prevent any potential truncation
- Change inbox_items.title and cleaned_content from VARCHAR(255) to TEXT
- Add integration test to verify long task names are preserved
- Add unit test to verify cleaned_content doesn't truncate

While investigation showed no actual truncation occurring in the codebase,
this defensive fix ensures unlimited text length for task names and inbox
content, eliminating any possibility of truncation at the database level.

Fixes #1016
2026-04-13 23:14:52 +03:00

47 lines
1.6 KiB
JavaScript

'use strict';
module.exports = {
async up(queryInterface, Sequelize) {
// Change task name from VARCHAR(255) to TEXT to prevent truncation
await queryInterface.changeColumn('tasks', 'name', {
type: Sequelize.TEXT,
allowNull: false,
});
// Change inbox_items cleaned_content from VARCHAR(255) to TEXT
await queryInterface.changeColumn('inbox_items', 'cleaned_content', {
type: Sequelize.TEXT,
allowNull: true,
comment: 'Content with tags and project references removed',
});
// Change inbox_items title from VARCHAR(255) to TEXT
await queryInterface.changeColumn('inbox_items', 'title', {
type: Sequelize.TEXT,
allowNull: true,
comment:
'Optional title field for inbox items, auto-generated for long content',
});
},
async down(queryInterface, Sequelize) {
// Revert back to VARCHAR(255)
await queryInterface.changeColumn('tasks', 'name', {
type: Sequelize.STRING,
allowNull: false,
});
await queryInterface.changeColumn('inbox_items', 'cleaned_content', {
type: Sequelize.STRING,
allowNull: true,
comment: 'Content with tags and project references removed',
});
await queryInterface.changeColumn('inbox_items', 'title', {
type: Sequelize.STRING,
allowNull: true,
comment:
'Optional title field for inbox items, auto-generated for long content',
});
},
};