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

Converting an existing table to Berlin feels complicated #156

Open
robincornett opened this issue Mar 22, 2023 · 0 comments
Open

Converting an existing table to Berlin feels complicated #156

robincornett opened this issue Mar 22, 2023 · 0 comments

Comments

@robincornett
Copy link

We are working with a few different existing tables, updating the code to register them with Berlin. Usually, as part of that, we are also making some kind of adjustment to the table and expecting to run an upgrade routine.

What we have discovered is that if the database table exists but does not have a db_version value saved to the database, that the fallback version false results in no pending upgrades being collected, even though we need them to be.

One solution we've implemented in the past, but which feels hard, is to override the maybe_upgrade method and add additional checks to make sure the initial upgrades run. What feels a little itchy about this is that the additional checks just always have to run.

What I'd like to suggest is changing the default for the get_db_version method to be something numeric, rather than false. It wouldn't affect a brand new install, since the table is installed if it doesn't exist and then the database version is set, at which point the default db_version value is moot. But for an existing install which saved the database version to the options table in a non-Berlin format, like 1.0 or something, it seems like it would trigger the upgrade process (it is for me in some testing).

I'm working on this scenario and have set the database default to be 1 in our version of the Berlin code and it seems to be working as I need, without having to resort to overriding the rest of the upgrade functionality.

robincornett added a commit to robincornett/berlindb-core that referenced this issue Mar 23, 2023
JJJ pushed a commit that referenced this issue Apr 3, 2023
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

No branches or pull requests

1 participant