Add logic to detect DROP TABLE

This commit is contained in:
David Wobrock committed 2019-07-29 23:14:30 +02:00
1 parent b79f9794ec
commit 4128c4b018
2 files changed
+16

No files matched your search

@@ -25,6 +25,16 @@ class SqliteAnalyser(BaseAnalyser):
and "__old" not in sql
and "new__" not in sql,
},
{
"code": "DROP_TABLE",
# TODO: improve to detect that the table names overlap
"fn": lambda sql_statements, **kw: any(
sql.startswith("DROP TABLE") for sql in sql_statements
)
and not any(sql.startswith("CREATE TABLE") for sql in sql_statements),
"err_msg": "DROPPING table",
"mode": "transaction",
},
{
"code": "NOT_NULL",
"fn": lambda sql_statements, **kw: any(