Skip to content

feat: Generated JS migrations in modern ESM format #10801

@w3nl

Description

@w3nl

Issue description

Generated JS migrations in modern ESM format
See also: https://nodejs.org/api/esm.html

ECMAScript modules are the official standard format to package JavaScript code for reuse. Modules are defined using a variety of import and export statements.

Expected Behavior

Generate ESM JS migrations, with import/export
So the migration works in a ESM codebase.

Actual Behavior

Generate CommonJS JS migrations
So migrations dont work now in a ESM codebase.

Steps to reproduce

Add "type": "module", to your package.json
Generate migrations with cli with the -o

My Environment

Dependency Version
Operating System
Node.js version 20.11.1
Typescript version 5.4.3
TypeORM version 0.3.20

Additional Context

No response

Relevant Database Driver(s)

  • aurora-mysql
  • aurora-postgres
  • better-sqlite3
  • cockroachdb
  • cordova
  • expo
  • mongodb
  • mysql
  • nativescript
  • oracle
  • postgres
  • react-native
  • sap
  • spanner
  • sqlite
  • sqlite-abstract
  • sqljs
  • sqlserver

Are you willing to resolve this issue by submitting a Pull Request?

Yes, I have the time, and I know how to start.

@pleerock PR is created: #10802

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions