mirror of
https://github.com/hasura/graphql-engine.git
synced 2024-09-21 15:38:40 +03:00
parent
f319b02766
commit
56063515e5
@ -793,7 +793,12 @@ WHERE
|
||||
export const isColTypeString = colType =>
|
||||
['text', 'varchar', 'char', 'bpchar', 'name'].includes(colType);
|
||||
|
||||
const isCascadable = sql => {
|
||||
const regex = new RegExp(/(\s|^)drop\s/i); // all queries with drop (with space on both sides Ie:this would ignore names matches with "" or prefix/suffix)
|
||||
return regex.test(sql);
|
||||
};
|
||||
const cascadePGSqlQuery = sql => {
|
||||
if (!isCascadable(sql)) return sql;
|
||||
if (sql[sql.length - 1] === ';')
|
||||
return sql.substr(0, sql.length - 1) + ' CASCADE;';
|
||||
// SQL might have a " at the end
|
||||
|
Loading…
Reference in New Issue
Block a user