learning_ai_common_plat/services/platform-service/src/migrations/registry.ts

29 lines
1.0 KiB
TypeScript

import type { MigrationDefinition } from './types.js';
/**
* Migration registry — ordered list of all migrations.
* Add new migrations to the end of this array.
*
* Each migration must be idempotent (safe to re-run).
*/
export const MIGRATIONS: MigrationDefinition[] = [
// Example migration — uncomment and adapt when first real migration is needed:
// {
// version: 1,
// name: '001_add_productId_to_legacy_users',
// description: 'Backfill productId field on users created before multi-product support',
// reversible: true,
// up: async () => {
// const { getContainer } = await import('../lib/cosmos.js');
// const users = getContainer('users');
// const { resources } = await users.items
// .query({ query: "SELECT * FROM c WHERE NOT IS_DEFINED(c.productId)" })
// .fetchAll();
// for (const user of resources) {
// user.productId = 'lysnrai';
// await users.item(user.id, user.id).replace(user);
// }
// },
// },
];