Skip to content

Add a way to run .ts files in Programmatic  #1199

Description

@BetaTH

Description

Error: Can't get migration files: /workspaces/clone-tabnews/src/infra/migrations/1718242225526_test-migration.ts:2
import { MigrationBuilder, ColumnDefinitions } from 'node-pg-migrate';
^^^^^^

SyntaxError: Cannot use import statement outside a module

I get this erro if a try to run typescript migrations files, generated by node-pg-migrate -j ts create.
Its seems a ""ESM | commonJS"" problem, but in CLI i can run .ts directly

Suggested solution

In CLI i can run node-pg-migrate up with passing tsconfig.json as a flag with compilerOptions.module: "commonjs" to directly run .ts files, it would be nice if i could do the same in the programmatic approach

Alternative

No response

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions