A MikroORM migration generator extension that automatically creates PostgreSQL triggers and functions to manage `updated_at` column updates, compensating for PostgreSQL's lack of native ON UPDATE CURRENT_TIMESTAMP support. Version 0.1.6 integrates with `@mikro-orm/migrations` ^6.5.6 and supports PostgreSQL 13-17. Unlike `onUpdate` in MikroORM entities, this ensures `updated_at` is updated even when using query builders or raw SQL. It generates full up/down migration scripts with customizable column names, types, function/trigger naming, and SQL. Designed for projects that need reliable `updated_at` behavior outside ORM-managed code.
npm install mikro-orm-pg-migration-generatorNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Configures MikroORM to use the migration generator with default options.
Ensure package.json contains @mikro-orm/migrations@^6.5.6
Use only in PostgreSQL projects.
Ensure custom factories produce valid PL/pgSQL and valid trigger/function definitions.
Customize functionNameFactory and triggerNameFactory to avoid collisions if multiple tables have updated_at columns.
Run 'npm install mikro-orm-pg-migration-generator' (or pnpm/yarn equivalent).
Use 'createMigrationGeneratorClass()' (a function that returns a class, not a class directly).