-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added version check and db upgrade scripts
- Loading branch information
1 parent
770c7d5
commit e2aabd8
Showing
6 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1.0.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# database upgrade script for v1.0.0 to v1.0.1 | ||
from pybot.helpers.core import CoreHelper | ||
|
||
|
||
def upgrade(): | ||
helper = CoreHelper() | ||
helper.cursor.execute(""" | ||
SELECT offset FROM core; | ||
""") | ||
offset = helper.cursor.fetchone()[0] | ||
helper.cursor.execute(""" | ||
DROP TABLE core; | ||
""") | ||
helper.save() | ||
helper.cursor.execute(""" | ||
CREATE TABLE core ( | ||
variable TEXT, | ||
value TEXT | ||
); | ||
""") | ||
helper.save() | ||
helper.cursor.execute(""" | ||
INSERT INTO core(variable, value) | ||
VALUES ("offset", ?) | ||
""", (offset, )) | ||
helper.save() | ||
helper.close() | ||
|
||
if __name__ == '__main__': | ||
upgrade() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
from setuptools import setup | ||
import os | ||
|
||
FILE_DIR = os.path.dirname(os.path.abspath(__file__)) | ||
version = open(FILE_DIR + '/pybot/etc/VERSION').read().strip() | ||
|
||
setup(name='pybot', | ||
version='1.0', | ||
version=version, | ||
description='A python bot for Telegram', | ||
url='https://github.com/daanbeverdam/pybot', | ||
author='Daan Beverdam') |