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.
29 lines
882 B
JavaScript
29 lines
882 B
JavaScript
/**
|
|
* Fix boolean compatibility issues between PostgreSQL and SQLite
|
|
* This migration updates the database configuration and existing data
|
|
*/
|
|
|
|
exports.up = async function(knex) {
|
|
const isPostgres = knex.client.config.client === 'pg';
|
|
|
|
if (!isPostgres) {
|
|
// Enable foreign keys for SQLite
|
|
await knex.raw('PRAGMA foreign_keys = ON');
|
|
|
|
// Note: SQLite stores booleans as 0/1
|
|
// No data migration needed as Knex handles this automatically
|
|
// But queries must use formatBoolean() helper
|
|
|
|
console.log('SQLite boolean compatibility check:');
|
|
console.log('- SQLite stores booleans as 0/1');
|
|
console.log('- All boolean comparisons should use formatBoolean() helper');
|
|
console.log('- Foreign keys enabled');
|
|
}
|
|
|
|
return Promise.resolve();
|
|
};
|
|
|
|
exports.down = async function(knex) {
|
|
// No rollback needed
|
|
return Promise.resolve();
|
|
}; |