This repository has been archived on 2022-02-23. You can view files and clone it, but cannot push or open issues or pull requests.
lets/secret/achievements/install/db.py

19 lines
693 B
Python
Raw Permalink Normal View History

2018-12-09 05:15:56 +00:00
import MySQLdb
import install_glob as glob
def run():
c = glob.sqlcon.cursor()
make_0(c)
alt_0(c)
print("Eyy! Database has been updated.")
def make_0(c):
c.execute("CREATE TABLE users_achievements (id int(11) NOT NULL,user_id int(11) NOT NULL,achievement_id int(11) NOT NULL,time int(11) NOT NULL) ENGINE=InnoDB DEFAULT CHARSET=latin1")
c.execute("ALTER TABLE users_achievements ADD PRIMARY KEY (id)")
c.execute("ALTER TABLE users_achievements MODIFY id int(11) NOT NULL AUTO_INCREMENT")
def alt_0(c):
c.execute("ALTER TABLE users ADD achievements_version INT NOT NULL DEFAULT '0' AFTER rank")
def make_connect(obj):
glob.sqlcon = MySQLdb.connect(**obj)