minor edits in dal
This commit is contained in:
@@ -1 +1 @@
|
|||||||
Version 2.6.0-development+timestamp.2013.08.07.07.03.01
|
Version 2.6.0-development+timestamp.2013.08.07.07.28.14
|
||||||
|
|||||||
+10
-6
@@ -1076,16 +1076,18 @@ class BaseAdapter(ConnectionPool):
|
|||||||
elif not key in sql_fields:
|
elif not key in sql_fields:
|
||||||
del sql_fields_current[key]
|
del sql_fields_current[key]
|
||||||
ftype = sql_fields_old[key]['type']
|
ftype = sql_fields_old[key]['type']
|
||||||
if self.dbengine in ('postgres',) and ftype.startswith('geometry'):
|
if (self.dbengine in ('postgres',) and
|
||||||
|
ftype.startswith('geometry')):
|
||||||
geotype, parms = ftype[:-1].split('(')
|
geotype, parms = ftype[:-1].split('(')
|
||||||
schema = parms.split(',')[0]
|
schema = parms.split(',')[0]
|
||||||
query = [ "SELECT DropGeometryColumn ('%(schema)s', '%(table)s', '%(field)s');" %
|
query = [ "SELECT DropGeometryColumn ('%(schema)s', "+
|
||||||
|
"'%(table)s', '%(field)s');" %
|
||||||
dict(schema=schema, table=tablename, field=key,) ]
|
dict(schema=schema, table=tablename, field=key,) ]
|
||||||
elif self.dbengine in ('firebird',):
|
elif self.dbengine in ('firebird',):
|
||||||
query = ['ALTER TABLE %s DROP %s;' % (tablename, key)]
|
query = ['ALTER TABLE %s DROP %s;' % (tablename, key)]
|
||||||
else:
|
else:
|
||||||
query = ['ALTER TABLE %s DROP COLUMN %s;'
|
query = ['ALTER TABLE %s DROP COLUMN %s;' %
|
||||||
% (tablename, key)]
|
(tablename, key)]
|
||||||
metadata_change = True
|
metadata_change = True
|
||||||
elif sql_fields[key]['sql'] != sql_fields_old[key]['sql'] \
|
elif sql_fields[key]['sql'] != sql_fields_old[key]['sql'] \
|
||||||
and not (key in table.fields and
|
and not (key in table.fields and
|
||||||
@@ -1124,8 +1126,10 @@ class BaseAdapter(ConnectionPool):
|
|||||||
self.log('faked!\n', table)
|
self.log('faked!\n', table)
|
||||||
else:
|
else:
|
||||||
self.execute(sub_query)
|
self.execute(sub_query)
|
||||||
# Caveat: mysql, oracle and firebird do not allow multiple alter table
|
# Caveat: mysql, oracle and firebird
|
||||||
# in one transaction so we must commit partial transactions and
|
# do not allow multiple alter table
|
||||||
|
# in one transaction so we must commit
|
||||||
|
# partial transactions and
|
||||||
# update table._dbt after alter table.
|
# update table._dbt after alter table.
|
||||||
if db._adapter.commit_on_alter_table:
|
if db._adapter.commit_on_alter_table:
|
||||||
db.commit()
|
db.commit()
|
||||||
|
|||||||
Reference in New Issue
Block a user