Skip to content

Commit 5b6e1dd

Browse files
committed
Add CI check
1 parent 9eb1e73 commit 5b6e1dd

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

scripts/check_updates.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from pglast import parse_sql
88
from pglast.ast import ColumnDef
9+
from pglast.enums.parsenodes import ObjectType
910
from pglast.visitors import Visitor
1011
from pglast import enums
1112
import 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
183196
def visit_sql(sql):

0 commit comments

Comments
 (0)