jasondcamp / pyway

A Flyway like migration manager written in python.
GNU General Public License v3.0
21 stars 12 forks source link

Using dot in major version creates extension bug and fake version in table #37

Closed billonalex closed 9 months ago

billonalex commented 9 months ago

Hello,

I'm trying to integrate pyway in a project which needs SQL migration.

I am trying to integrate files with patterns like : V5.0_01__initial_schema.sql However, the version in pyway schema table gives me : 0.01... I would need it to be 5.0.01 ({major}.{minor}). If I write a dot in major version (ex: V5.0), it seems the extension is not SQL anymore, but the name of the script (in my case : 0_01__INITIAL_SCHEMA)...

Capture dโ€™eฬcran 2023-12-14 aฬ€ 15 50 49

Could you please look to consider this evolution ? Thank you ๐Ÿ™‚

jasondcamp commented 9 months ago

Just to clarify, do you mean you'd like it to support semantic versioning? Or you'd like to support the ability to have dots in the name itself? I could just disallow dots from the regexp but I'd prefer to support what you're trying to do.

billonalex commented 9 months ago

Both would be great. It would be useful for my case to use dots in major version (ex: 5.0) and with the minor version of the script it will make a version 5.0.01 in the table (so semantic version). I think (but I may be wrong) just disallowing dots in the regexp for the major version would be enough to do what I try to do, am I wrong ?

jasondcamp commented 9 months ago

great thanks for the info, I'll work on this!

jasondcamp commented 9 months ago

I added the ability to use dots in the major and minor versions, added support for semantic versioning in general, and added all of the needed tests around it. You can also use either periods or underscores to separate the major/minor/patch versions. Hopefully this should do the trick, please let me know if you run into any issues.

billonalex commented 9 months ago

Just tested the feature with 0.3.21, it works perfectly.

Great thanks to you for your work, it will be very useful for me ๐Ÿ˜ƒ

jasondcamp commented 9 months ago

Awesome great to hear!!! Please let me know if you run into any other issues while using, I appreciate it!.