deluan / contentful-migrate

🐎 Schema migration tooling for Contentful, with state management
https://www.contentful.com/blog/2018/09/13/content-model-changes-scale-telus-cms-as-code/
MIT License
60 stars 37 forks source link

Make migrations directory configurable #165

Closed void-- closed 3 years ago

void-- commented 3 years ago

These changes allow the user to have the migrations directory somewhere other than the project root, and allow for a directory name other than "migrations" by setting the fully qualified path to the desired migrations directory in the CONTENTFUL_MIGRATIONS_DIR environment variable.

void-- commented 3 years ago

Hey @deluan ! Anything I can do to help get this merged? Or is there a different way you would like to see this implemented?

deluan commented 3 years ago

Sorry for the delay, I'm planning to update all dependencies and releasing a new version today, including this PR. Thanks for your contribution

void-- commented 3 years ago

Awesome, no problem! Sorry for pushing!

bits-by-brandon commented 3 years ago

@deluan This PR would be really helpful for us! Could you take another look at this issue?

deluan commented 3 years ago

I started updating the project, but the integration tests are failing. Will have to fix that first. This PR is in my todo list for the next release

deluan commented 3 years ago

Sorry about the delay on this issue, but I'd like to understand how people want to use this. Schema migration scripts should be version controlled with application code, so they can be in sync (the schema reflects what is expected by the application).

I agree that the folder could be configurable, but it should always be a folder under the project's root (or under some subdir inside the root). With this PR, one could potentially have their migration scripts outside of the project's source repository, which could cause issues, as the project's code and the Contentful schema could become out-of-sync.

Is this really a desirable feature? What is the use case? Why it is so important to change the folder where migrations are stored? I see this the same as the location of, say, the package.json: There's a convention where it is stored and people know where to look for it. Maybe I'm missing something here.....

void-- commented 3 years ago

No worries!

So, we actually forked the project and have been using this for a while -- the two main benefits for us are a) we get to pick where the migrations directory is (obviously), meaning we can group it together with other contentful related directories (e.g. apps/ui-extensions/schema). and b) we don't have to cd into the directory to run the command, we can just run it from wherever.

Neither of these benefits are things we couldn't live without, but it's definitely made the tool much more enjoyable to use.

I understand your concern about placing the migrations dir outside of version control, that would be a very bad idea, but maybe could be mitigated by adding this caveat to the documentation?

void-- commented 3 years ago

@deluan whatcha think? should I add a note in the documentation, or are you opposed to moving forward with this?

deluan commented 3 years ago

Yes, let's add a note in the documentation, and I'll merge this. Can you please add it?

aladage commented 3 years ago

Hello! Any updates on when this PR will be merged? My team could also really use this feature soon.

void-- commented 3 years ago

Hey Aaron! Sorry, I'll try to make that note in the documentation this afternoon!

aladage commented 3 years ago

No worries! Thank you for the quick response; I'll look forward to seeing it!

void-- commented 3 years ago

Okay @deluan pushed!

deluan commented 3 years ago

LGTM. Thanks!