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

create separate method for each currentVersion of class_sqlThread module #1715

Draft
wants to merge 2 commits into
base: v0.6
Choose a base branch
from

Conversation

navjotcis
Copy link
Contributor

I have created a separate method for each version of the class_sqlThread module
and also added a decorator for removing repeated code.

@PeterSurda PeterSurda self-assigned this Jan 14, 2021
@PeterSurda PeterSurda added this to To do in Code quality via automation Jan 14, 2021
@PeterSurda PeterSurda added this to the v0.6.4 milestone Jan 14, 2021
@navjotcis navjotcis force-pushed the bug-fixes18 branch 3 times, most recently from 12aedb9 to 9ac0a28 Compare January 18, 2021 18:33
Copy link
Member

@PeterSurda PeterSurda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed on Skype, rework the decorator so that it handles the current version, and auto-populates the upgrade loop.

@navjotcis navjotcis force-pushed the bug-fixes18 branch 2 times, most recently from 7fa12e4 to ddd5b9d Compare January 20, 2021 17:57

def db_upgrade(**kwargs):
"""upgrade the migration"""
version_dict = kwargs
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks weird

parameters = (4,)
self.cur.execute(item, parameters)

@db_upgrade(versio_four=4)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

parameters = (5,)
self.cur.execute(item, parameters)

@db_upgrade(versio_five=5)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

'''INSERT INTO addressbook SELECT label, address FROM old_addressbook;''')
self.cur.execute('''DROP TABLE old_addressbook''')
self.cur.execute('''update settings set value=11 WHERE key='version';''')
if temp_dict.get(currentVersion) or currentVersion == 1:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add a dummy version 1?

@navjotcis navjotcis force-pushed the bug-fixes18 branch 2 times, most recently from f2b61dc to f5b7734 Compare January 21, 2021 12:01
@g1itch
Copy link
Collaborator

g1itch commented Feb 2, 2021

Wouldn't it be better to tag 0.6.3.3 and declare it as last release supporting upgrade from 0.6.1 or older? I tried rewriting class_sqlThread too, but all attempts look ugly like this PR.

@g1itch
Copy link
Collaborator

g1itch commented May 28, 2021

This looks abandoned and superseded by #1760.

@g1itch g1itch marked this pull request as draft August 17, 2021 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Code quality
  
To do
Development

Successfully merging this pull request may close these issues.

None yet

3 participants