tbicr / django-pg-zero-downtime-migrations

Django postgresql backend that apply migrations with respect to database locks
MIT License
525 stars 25 forks source link

Is package really still beta? #67

Open denisSurkov opened 4 months ago

denisSurkov commented 4 months ago

Hi!

Thank you for this library. I think it's cool to have 500 stars, tests, 16k download per month, and clear readme.md description.

I would like to add this library to my project. But I'm a little bit worried, why this note exists?

NOTE: this package is in beta, please check your migrations SQL before applying on production and submit issue for any question.

Is it battle tested? Can you provide some examples on why this can be still beta?

denisSurkov commented 4 months ago

Also, may be someone know a way to avoid problems on makemigrations step?

Or there are no easy way to change behavior of how makemigrations works?

tbicr commented 4 months ago

Hi

NOTE: this package is in beta, please check your migrations SQL before applying on production and submit issue for any question.

This note was added when the library was released. Even though it has tests and some companies use it, it might not cover all your scenarios. So, it's important to understand how it works and how it fits your company's processes. For example, in one company where I used this library, we looked at our common migration cases to see if it worked well for us. Our main goals were to avoid long table locks using statement and lock timeouts and to save developers' time on both successful and failed migrations.

If you have issues with makemigrations, please provide details and create an issue.

denisSurkov commented 3 months ago

@tbicr, thank you for your answer!

If you have issues with makemigrations, please provide details and create an issue.

No, I don't have any issues. I was asking if there are way to change how makemigrations work. For example, always add CreateIndexConcurrently() instead of CreateIndex(). And add atomic = False by default.

Maybe you know some workarounds?


By the way, I think it's nice to mention, that your package is used by sentry. I think this alone says a lot about package maturity.

tbicr commented 3 months ago

For sure it possible to change makemigrations, but I not sure is it exists any ready package that can handle all you need.

Looks like you need something similar that this lib do - it patch django migration writer and add to standard migration file comment with locally called sql using showmigrations. The biggest issue in this approach that django use introspection, so result sql can be different for local empty db, local up to date db state, production db or any other env, but if you need only add atomic = False and replace CreateIndex with CreateIndexConcurrently it definitely possible achieve similar way.