Commit 8b050fb7 authored by Jérome Perrin's avatar Jérome Perrin

custom_zodb: drop views first

tables() method of ZMySQLDA returns also views, which are not deleted
with DROP TABLE but with DROP VIEW instruction.
parent 468da0e3
......@@ -69,6 +69,11 @@ else:
from Products.ERP5.ERP5Site import default_sql_connection_string
sql_db = Products.ZMySQLDA.db.DB(os.environ.get('erp5_sql_connection_string',
default_sql_connection_string))
_, view_list = sql_db.query("SHOW FULL TABLES WHERE table_type='VIEW'")
if view_list:
sql_db.query('DROP VIEW ' +
','.join('`%s`' % view[0] for view in view_list))
table_list = sql_db.tables()
if table_list:
sql_db.query('DROP TABLE ' +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment