LibreChat/config/migrate-tenant-indexes.js
Danny Avila dad20b115e
🛗 fix: Add Tenant Index Upgrade Migration (#15767)
* fix: expose tenant index upgrade migration

* fix: retry tenant migration index builds

* docs: run tenant migration from the image root
2026-09-09 00:10:40 -04:00

21 lines
646 B
JavaScript

require('dotenv').config();
process.env.MONGO_AUTO_INDEX = 'false';
process.env.MONGO_AUTO_CREATE = 'false';
const mongoose = require('mongoose');
const { migrateTenantIndexes } = require('@librechat/data-schemas');
const connect = require('./connect');
(async () => {
try {
await connect();
const result = await migrateTenantIndexes(mongoose.connection, {
dryRun: process.argv.includes('--dry-run'),
});
process.exitCode = result.errors.length > 0 ? 1 : 0;
} catch (error) {
console.error('Tenant index migration failed:', error);
process.exitCode = 1;
} finally {
await mongoose.disconnect();
}
})();