|
@@ -3,6 +3,8 @@
|
3
|
3
|
import copy
|
4
|
4
|
import pymysql
|
5
|
5
|
|
|
6
|
+from Lodel.settings import Settings
|
|
7
|
+
|
6
|
8
|
import EditorialModel
|
7
|
9
|
import EditorialModel.classtypes
|
8
|
10
|
import EditorialModel.fieldtypes
|
|
@@ -44,11 +46,15 @@ class MysqlMigrationHandler(DummyMigrationHandler):
|
44
|
46
|
# @param user str : The db user
|
45
|
47
|
# @param password str : The db password
|
46
|
48
|
# @param db str : The db name
|
47
|
|
- def __init__(self, host, user, passwd, db, module=pymysql, db_engine='InnoDB', foreign_keys=True, debug=False, dryrun=False, drop_if_exists=False):
|
|
49
|
+ def __init__(self, module = pymysql, conn_args = None, db_engine='InnoDB', foreign_keys=True, debug=None, dryrun=False, drop_if_exists=False):
|
48
|
50
|
self._dbmodule = module
|
|
51
|
+ if conn_args is None:
|
|
52
|
+ conn_args = copy.copy(Settings.get('datasource')['default'])
|
|
53
|
+ self._dbmodule = conn_args['module']
|
|
54
|
+ del conn_args['module']
|
|
55
|
+ self.db = self._dbmodule.connect(**conn_args)
|
49
|
56
|
#Connect to MySQL
|
50
|
|
- self.db = self._dbmodule.connect(host=host, user=user, passwd=passwd, db=db)
|
51
|
|
- self.debug = debug
|
|
57
|
+ self.debug = Settings.get('debug') if debug is None else debug
|
52
|
58
|
self.dryrun = dryrun
|
53
|
59
|
self.db_engine = db_engine
|
54
|
60
|
self.foreign_keys = foreign_keys if db_engine == 'InnoDB' else False
|