9854ca2f59
Mirror to GitHub / mirror (push) Successful in 27s
Test and Lint / backend-test (push) Successful in 1m21s
continuous-integration/drone/push Build is passing
Test and Lint / frontend-test (push) Successful in 2m4s
Version and Release / version-bump (push) Failing after 31s
Version and Release / trigger-drone (push) Has been skipped
- Created core/ directory for essential migrations that always run - Created legacy/ directory for migrations only needed when upgrading - New deployments will only run core migrations for a clean database - Existing deployments will run all migrations in proper sequence - Fixed duplicate migration numbers (014 and 027) - Updated migration runners to handle new directory structure - Added README explaining the migration organization This change optimizes deployment for new users who will get a clean schema without running unnecessary upgrade migrations.
33 lines
1.1 KiB
JavaScript
33 lines
1.1 KiB
JavaScript
/**
|
|
* Fix email_queue table by ensuring it doesn't have updated_at column
|
|
* This migration addresses the PostgreSQL error where queries are trying to update
|
|
* a non-existent updated_at column
|
|
*/
|
|
|
|
exports.up = async function(knex) {
|
|
// First, check if the column exists
|
|
const hasUpdatedAt = await knex.schema.hasColumn('email_queue', 'updated_at');
|
|
|
|
if (hasUpdatedAt) {
|
|
console.log('Found updated_at column in email_queue table, removing it...');
|
|
await knex.schema.table('email_queue', (table) => {
|
|
table.dropColumn('updated_at');
|
|
});
|
|
}
|
|
|
|
// Also ensure the table has all required columns
|
|
const hasCreatedAt = await knex.schema.hasColumn('email_queue', 'created_at');
|
|
if (!hasCreatedAt) {
|
|
console.log('Adding missing created_at column to email_queue table...');
|
|
await knex.schema.table('email_queue', (table) => {
|
|
table.datetime('created_at').defaultTo(knex.fn.now());
|
|
});
|
|
}
|
|
|
|
console.log('email_queue table schema fixed');
|
|
};
|
|
|
|
exports.down = async function(knex) {
|
|
// In the down migration, we don't add back updated_at since it shouldn't exist
|
|
// This is intentionally left minimal
|
|
}; |