1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-12 13:24:52 +00:00

Improve the sqlite-to-mysql scripts

This commit is contained in:
xiez
2012-03-25 11:12:45 +08:00
parent e140e49a5c
commit 60ced5d61e
2 changed files with 13 additions and 8 deletions

View File

@@ -12,9 +12,14 @@ try:
dbuser = os.environ['DBUSER']
dbpasswd = os.environ['DBPASSWD']
except:
print 'Environment not set! Exit'
sys.stderr.write('Environment not set! Exit\n')
sys.exit(1)
def check_settings():
if settings.DATABASE_ENGINE == 'mysql':
sys.stderr.write('[ERROR] Current settings is mysql, need sqlite settings\n')
sys.exit(1)
def do_create():
root_passwd = raw_input("Please enter root password to create database %s: " % dbname)
@@ -41,6 +46,9 @@ def do_delete(prefix):
pass
if __name__=="__main__":
# check current settings.py
check_settings()
# create database if not exists
do_create()