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: add custom timestamp option in migration creation #8501

Merged

Conversation

carmi2214
Copy link
Contributor

@carmi2214 carmi2214 commented Jan 3, 2022

An option in the CLI to specify a custom timestamp when creating or generating a migration.

Closes: #8500

Description of change

An option in the CLI to specify a custom timestamp when creating / generating a migration.

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

An option in the CLI to specify a custom timestamp when creating or generating a migration.

Closes: typeorm#8500
docs: added description for the option

An option in the CLI to specify a custom timestamp when creating or generating a migration.

Closes: typeorm#8500
@pleerock
Copy link
Member

What is the real-world usage example of this feature?

@carmi2214
Copy link
Contributor Author

What is the real-world usage example of this feature?

I have a script that runs migration:generate for multiple schemas.

When I activate the script, it results with the same migration, across multiple files + rows in migrations table in each schema,
with a little difference - the timestamp.

It could help to have the same exact name from the beginning without changing it manually,
for the case where you need to copy your schema's content into another one (with the same migrations table),
or for comparing migrations' history, etc.

@pleerock pleerock merged commit 4a7f242 into typeorm:master Jan 31, 2022
@pleerock
Copy link
Member

Thank you for contribution! 🎉

@MartinHarkins
Copy link

Perfect I was just needing this !

Usecase:
Using SQLite :memory: for testing. Simple to just generate the full DB migration when the schema changes (instead of piecemeal).
Having a static timestamp will help us avoid some git conflicts/maintenance (timestamp always changes, while not being relevant to our scenario)

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.

Custom timestamp option in migration creation
3 participants