question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Create Migrations in specific folder / Hook to modify folder

See original GitHub issue

Feature Description

allow creation of migration files in subfolders of migration dir. Like YYYY/MM

The Problem

All migrations are created in the migrationDir

  "cli": {
    "migrationsDir": "src/migrations"
  }

The Solution

I am thinking of 2 options:

Option 1

{
  "cli": {
    "migrationsDir": "src/migrations",
    "migrationSubFolder": "YYYY/MM"
  }
}

Option 2 (only for js / inline config)

module.export = {
  cli: {
    migrationsDir: "src/migrations",
   migrationSubFolder: () => {
      return 'name/of/sub/folder'
    }
  }
}

Considered Alternatives

currently we are moving the files manually - not optimal

Additional Context

Relevant Database Driver(s)

DB Type Relevant
aurora-data-api yes
aurora-data-api-pg yes
better-sqlite3 yes
cockroachdb yes
cordova yes
expo yes
mongodb yes
mysql yes
nativescript yes
oracle yes
postgres yes
react-native yes
sap yes
sqlite yes
sqlite-abstract yes
sqljs yes
sqlserver yes

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

  • ✖️ Yes, I have the time, and I know how to start.
  • ✖️ Yes, I have the time, but I don’t know how to start. I would need guidance.
  • ✅ No, I don’t have the time, but I can support (using donations) development.
  • ✅ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
imnotjamescommented, Aug 5, 2021

Wouldn’t you need to anyway? You’d just be setting the subfolder to a month instead of a dir.

Why not Something like this?

module.export = {
  cli: {
    migrationsDir: path.join("src/migrations", year, month),
  }
}
1reaction
pleerockcommented, Aug 11, 2021

damn sorry for the confusion, I completely forgot we have two separate options 🙊

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to change the output folder for migrations with asp.net ...
Defaults to generated from the output directory. Added in EF Core 5.0. ... New migrations are created as siblings of the last migration....
Read more >
Migration classic vs. modern folder - UiPath Community Forum
Hi all, I currently have 2 production classic robots and I need to move them inside a modern folder where I already have...
Read more >
Create and populate folders | Google Drive
To create a folder, use the files.create method with the application/vnd.google-apps.folder MIME type and a title. The following code snippet shows how to ......
Read more >
Database Migrations with Knex - Perk
Migrations are simply files that live in the /migrations directory of your project. When you use the perk command line tool to create...
Read more >
Migrations with Multiple Providers - EF Core | Microsoft Learn
You don't need to specify the output directory for subsequent migrations since they are created as siblings to the last one.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found