← Back to team overview

brewtarget-devs team mailing list archive

Re: Fixing sugars

 

The merge request comes from my "migrations" branch, so you can add me as a
remote, then check it out.
WARNING: compiling and running this version will modify your database!

git remote add philip
https://git.gitorious.org/~philiplee/brewtarget/philiplees-brewtarget.git
git fetch philip
git checkout -b philip/migrations philip/migrations

Unless you want to make merge requests to my personal branches, don't make
modifications or merge from this branch...just have a look and delete it
when you are done with it.

The basic idea is:
1) Add a new field in the database to record the database "version". If the
field is not present, it is assumed to be version "2.0.0". Since the next
release will be 2.0.2, the latest version will be "2.0.2" and so on.
2) Provide migration scripts from earlier database versions to newer ones.
These will add/drop/modify fields and the db version string.
3) Provide an xml file that lists the available migrations (provided as
resource files), and which version they upgrade from/to.
4) On startup, check the local database version against the one that the
current brewtarget needs. If it is less, run migration scripts until the
database is up-to-date.

As for ALTER TABLE, I don't think you have to worry about it. We require Qt
>= 4.7, whose sqlite3 driver is 3.6.something I think.


On Sat, May 25, 2013 at 9:25 AM, mik firestone <mikfire@xxxxxxxxx> wrote:

> Oh. And I want to use ALTER TABLE ADD COLUMN command. The sqlite3
> documentation says this will make the database unreadable by any version
> earlier than 3.1.3 and is only supported by v 3.2.0 and later. Those
> versions were both released somewhere in 2005.
>
> Is it a safe assumption that most of our users have updated sqlite within
> the past 8 years? Otherwise, I will need to create a temp table with the
> new definitions, copy the old table's data into the temp, drop the old
> table and rename the new. I can do it, but its a pain.
>
> Mik
>
>
> On Sat, May 25, 2013 at 10:03 AM, mik firestone <mikfire@xxxxxxxxx> wrote:
>
>> Okay.
>>
>> How do I pull that branch so I can test it and make sure my changes will
>> work?
>>
>> Mik
>>
>>
>>
>> On Sat, May 25, 2013 at 9:33 AM, Philip Lee <rocketman768@xxxxxxxxx>wrote:
>>
>>> Perfect :)
>>>
>>> I have had a pending merge request sitting until this issue came up.
>>> Have a really good look, and let's make sure we do this one carefully and
>>> right before proceeding. My main question on the current request is if we
>>> also need _backward_ migrations as well as forward ones.
>>>
>>>
>>> On Sat, May 25, 2013 at 8:30 AM, mik firestone <mikfire@xxxxxxxxx>wrote:
>>>
>>>> Based on the way the  math works, I am going to need to add another
>>>> field to the brewnote to track the expected fermentable sugars to account
>>>> for non-mashed additions. I *think* this may also fix some of the problems
>>>> people are seeing with unexpectedly high pre-boil OG.
>>>>
>>>> Have we mapped out a process for adding a new field to the database?
>>>>
>>>> Mik
>>>>
>>>> --
>>>> In a world of ninja v. pirate, I pilot a Gundam
>>>>
>>>> --
>>>> Mailing list: https://launchpad.net/~brewtarget-devs
>>>> Post to     : brewtarget-devs@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~brewtarget-devs
>>>> More help   : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>>
>>> --
>>> Philip G. Lee
>>> rocketman768@xxxxxxxxx
>>>
>>
>>
>>
>> --
>> In a world of ninja v. pirate, I pilot a Gundam
>>
>
>
>
> --
> In a world of ninja v. pirate, I pilot a Gundam
>



-- 
Philip G. Lee
rocketman768@xxxxxxxxx

References