File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 66
77from pglast import parse_sql
88from pglast .ast import ColumnDef
9+ from pglast .enums .parsenodes import ObjectType
910from pglast .visitors import Visitor
1011from pglast import enums
1112import sys
@@ -178,6 +179,18 @@ def visit_CreateFunctionStmt(
178179 "_timescaledb_functions should be used as schema for internal functions" ,
179180 )
180181
182+ def visit_DropStmt (self , _ancestors , node ):
183+ if node .removeType == ObjectType .OBJECT_VIEW :
184+ if node .objects [0 ][0 ].sval == "_timescaledb_experimenal" :
185+ self .error (
186+ f"Attempting to drop view { node .objects [0 ][0 ].sval } .{ node .objects [0 ][1 ].sval } " ,
187+ "TEST" ,
188+ )
189+ if node .objects [0 ][0 ].sval == "timescaledb_information" :
190+ self .error (
191+ f"Attempting to drop view { node .objects [0 ][0 ].sval } .{ node .objects [0 ][1 ].sval } " ,
192+ "Views in schema timescaledb_information must not be dropped in update scripts" ,
193+ )
181194
182195# copied from pgspot
183196def visit_sql (sql ):
You can’t perform that action at this time.
0 commit comments