mirror of
https://github.com/OCA/reporting-engine.git
synced 2025-02-16 16:30:38 +02:00
lint check. unnecessary queries in uninstall hook.
This commit is contained in:
@@ -10,43 +10,3 @@ def uninstall_hook(cr, registry):
|
||||
recs = env['bi.sql.view'].search([])
|
||||
for rec in recs:
|
||||
rec.button_set_draft()
|
||||
rec.unlink()
|
||||
|
||||
# delete dirty data that could cause problems
|
||||
# while re-installing the module
|
||||
# Drop materialized views
|
||||
cr.execute("""
|
||||
select relname
|
||||
from pg_class
|
||||
where relname like 'x_bi_sql_view%' and relkind='m'
|
||||
""")
|
||||
for r in cr.fetchall():
|
||||
cr.execute("""
|
||||
DROP MATERIALIZED VIEW %s
|
||||
""" % r)
|
||||
|
||||
cr.execute("""
|
||||
select relname
|
||||
from pg_class
|
||||
where relname like 'x_bi_sql_view%' and relkind='r'
|
||||
""")
|
||||
for r in cr.fetchall():
|
||||
cr.execute("""
|
||||
DROP TABLE %s
|
||||
""" % r)
|
||||
cr.execute("""
|
||||
select table_name from INFORMATION_SCHEMA.views
|
||||
where table_name like 'x_bi_sql%'""")
|
||||
|
||||
# Drop not materialized views
|
||||
for v in cr.fetchall():
|
||||
cr.execute("""
|
||||
DROP VIEW %s
|
||||
""" % v)
|
||||
|
||||
# Drop table if uninstalling went wrong
|
||||
cr.execute("""
|
||||
delete from ir_model_fields where model like 'bi.sql.view%';
|
||||
delete from ir_model_fields where model like 'bi_sql_%';
|
||||
delete from ir_model where model like 'x_bi_sql_view.%';
|
||||
""")
|
||||
|
||||
Reference in New Issue
Block a user