Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEAT] Optionally output migrations as Javascript files instead of TypeScript #7253

Merged
merged 1 commit into from
Jan 11, 2021

Conversation

foxxor
Copy link
Contributor

@foxxor foxxor commented Jan 7, 2021

Description of change

This is a proposal that attempts to address the discussion here: #1675

Added a new -o / --outputJs option to the migrate:create and migrate:generate commands, to be able to output directly to Javascript. This would help for Javascript only projects in which having TypeScript files as part of the project would complicate maintenance, and eliminates the need for an extra ts-node transpiling command to run the migrate:run.

Tested locally the migrate:create, by manually running the compiled project cli.js file. I didn't manage to link my local build version to work with the generate. I'd like some help or instructions to be able to compile and test the other command.

Pull-Request Checklist

  • Code is up-to-date with the master branch
  • npm run lint passes with this change
  • npm run test passes with this change
  • This pull request links relevant issues as Fixes #0000
  • There are new or updated unit tests validating the change
  • Documentation has been updated to reflect this change
  • The new commits follow conventions explained in CONTRIBUTING.md

@nebkat
Copy link
Contributor

nebkat commented Jan 9, 2021

Code wise looks good, you should squash the commits into a single feat: Javascript file migrations output.

@foxxor
Copy link
Contributor Author

foxxor commented Jan 11, 2021

@nebkat Done 👍

@pleerock
Copy link
Member

Thank you for contribution! 🎉

Can you please add docs about this feature in a separate PR?
Also would be really great if you can add tests to this feature.

@pleerock pleerock merged commit ce9cb87 into typeorm:master Jan 11, 2021
@foxxor
Copy link
Contributor Author

foxxor commented Jan 12, 2021

Thanks @pleerock I will add the docs, tests and will submit a PR then. 👍

@foxxor
Copy link
Contributor Author

foxxor commented Jan 18, 2021

Added documentation and tests on: #7294

cc @pleerock

@ajesicus
Copy link

@foxxor Great job, I'm expecting this feature for sometime. Thank you very much.

It would be great if you could also update sample repo for javascript+babel.
I would suggest

  • few migration scripts
  • add migration scripts into package.json

@foxxor
Copy link
Contributor Author

foxxor commented Jan 19, 2021

@ajesicus Sure!

zshipleyTAG pushed a commit to Amherst-Development/typeorm that referenced this pull request Oct 7, 2022
* typeorm-0.2.30: (212 commits)
  version bump
  docs: fix javascript usage examples (typeorm#7031)
  fix: resolve migration for UpdateDateColumn without ON UPDATE clause (typeorm#7057)
  fix: Error when sorting by an embedded entity while using join and skip/take (typeorm#7082)
  fix: resolves Postgres sequence identifier length error (typeorm#7115)
  feat: closure table custom naming (typeorm#7120)
  feat: relations: Orphaned row action (typeorm#7105)
  docs: fix invalid code block in "find many options" (typeorm#7268)
  docs: Embodying the example (typeorm#7116)
  docs: document withDeleted option (typeorm#7132)
  fix: return 'null' (instead of 'undefined') on lazy relations that have no results (typeorm#7146) (typeorm#7147)
  docs: update cascade options (typeorm#7140)
  docs: add .ts to supported ormconfig formats (typeorm#7139)
  fix: improve stack traces when using persist executor (typeorm#7218)
  refactor: remove Oracle multirow insert workaround (since typeorm#6927) (typeorm#7083)
  feat: add NOWAIT and SKIP LOCKED lock support for MySQL (typeorm#7236)
  docs: update OneToMany grammar (typeorm#7252)
  feat: JavaScript file migrations output (typeorm#7253)
  docs: update Repository.ts (typeorm#7254)
  chore: update dependency cli-highlight to v2.1.10 (typeorm#7265)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants