Skip to content

Commit cb8e104

Browse files
committed
support \\restrict in Schema.sql
recent postgres versions add a \\restrict command to the Schema.sql. we need to ignore that
1 parent c443f43 commit cb8e104

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

ihp-ide/IHP/IDE/SchemaDesigner/Parser.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ stringLiteral :: Parser String
6060
stringLiteral = char '\'' *> manyTill Lexer.charLiteral (char '\'')
6161

6262
parseDDL :: Parser [Statement]
63-
parseDDL = optional space >> manyTill statement eof
63+
parseDDL = optional space >> (restrict <|> manyTill statement eof)
6464

6565
statement = do
6666
space
@@ -996,3 +996,11 @@ commit = do
996996
removeTypeCasts :: Expression -> Expression
997997
removeTypeCasts (TypeCastExpression value _) = value
998998
removeTypeCasts otherwise = otherwise
999+
1000+
restrict = do
1001+
lexeme "\\restrict"
1002+
key <- identifier
1003+
inner <- manyTill statement (lexeme "\\unrestrict")
1004+
symbol key
1005+
eof
1006+
pure inner

0 commit comments

Comments
 (0)