mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Add missing reverse-engineered SQL header and drop statement for sequences. Fixes #3081
This commit is contained in:
parent
96165044ae
commit
c85e14dc25
@ -141,15 +141,19 @@ class SequenceView(PGChildNodeView):
|
|||||||
@wraps(f)
|
@wraps(f)
|
||||||
def wrapped(self, *args, **kwargs):
|
def wrapped(self, *args, **kwargs):
|
||||||
|
|
||||||
self.manager = get_driver(PG_DEFAULT_DRIVER).connection_manager(kwargs['sid'])
|
driver = get_driver(PG_DEFAULT_DRIVER)
|
||||||
|
self.manager = driver.connection_manager(kwargs['sid'])
|
||||||
|
|
||||||
if action and action in ["drop"]:
|
if action and action in ["drop"]:
|
||||||
self.conn = self.manager.connection()
|
self.conn = self.manager.connection()
|
||||||
elif 'did' in kwargs:
|
elif 'did' in kwargs:
|
||||||
self.conn = self.manager.connection(did=kwargs['did'])
|
self.conn = self.manager.connection(did=kwargs['did'])
|
||||||
else:
|
else:
|
||||||
self.conn = self.manager.connection()
|
self.conn = self.manager.connection()
|
||||||
|
|
||||||
self.template_path = 'sequence/sql/#{0}#'.format(self.manager.version)
|
self.template_path = 'sequence/sql/#{0}#'.format(self.manager.version)
|
||||||
self.acl = ['r', 'w', 'U']
|
self.acl = ['r', 'w', 'U']
|
||||||
|
self.qtIdent = driver.qtIdent
|
||||||
|
|
||||||
return f(self, *args, **kwargs)
|
return f(self, *args, **kwargs)
|
||||||
return wrapped
|
return wrapped
|
||||||
@ -625,6 +629,15 @@ class SequenceView(PGChildNodeView):
|
|||||||
if not isinstance(SQL, (str, unicode)):
|
if not isinstance(SQL, (str, unicode)):
|
||||||
return SQL
|
return SQL
|
||||||
SQL = SQL.strip('\n').strip(' ')
|
SQL = SQL.strip('\n').strip(' ')
|
||||||
|
|
||||||
|
sql_header = u"""-- SEQUENCE: {0}
|
||||||
|
|
||||||
|
-- DROP SEQUENCE {0};
|
||||||
|
|
||||||
|
""".format(self.qtIdent(self.conn, result['schema'], result['name']))
|
||||||
|
|
||||||
|
SQL = sql_header + SQL
|
||||||
|
|
||||||
return ajax_response(response=SQL)
|
return ajax_response(response=SQL)
|
||||||
|
|
||||||
def _formatter(self, data, scid, seid):
|
def _formatter(self, data, scid, seid):
|
||||||
|
Loading…
Reference in New Issue
Block a user