spacepy / dbprocessing

Automated processing controller for heliophysics data
5 stars 4 forks source link

Database versioning is needed #7

Open jtniehof opened 4 years ago

jtniehof commented 4 years ago

Work over the past few years has resulted in some small changes to the database structure. Right now there is code that allows everything to work with old or new databases, but at some point the structure should firm up and be assigned a version number, so that the structure of the database can be known (and eventually code to support old structures removed.)

Changes that I can recall:

Closure condition

This issue should be closed when the database versioning has been defined (e.g. what constitutes an increment, what is current, where is the version stored) and code is available to migrate earlier versions of database to current version, compatible at least with postgres and sqlite.

jtniehof commented 3 years ago

I guess one question is whether we want to version the entire database, or table-by-table. I think the entire db is probably easier.

balarsen commented 3 years ago

whole thing works for me... way easier to keep track

jtniehof commented 3 years ago

Whole thing it seems to be. I think we can have an arg to the DButils __init__ specifying a minimum version and then have migration scripts...so once we define v.1, we have a script that migrates v. 0 to v. 1 and then the __init__ defaults to requiring v. 1, and we can rip out a lot of the peanut butter.

jtniehof commented 2 years ago

Migration scripts might also want to fix types on databases where sqlite doesn't enforce typing...there are a lot of booleans that were treated as 0/1 in the code at some point and that has almost certainly leaked into database. Similarly for empty string vs. NULL.