From e2f02b6a09548e74304cbc6e32b6ce720d6dba84 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Fri, 16 Oct 2026 09:11:52 +0100 Subject: Add primary key constraint to SQL AST --- hobgoblin/src/output/lang/sql/ast.hob | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'hobgoblin/src') diff --git a/hobgoblin/src/output/lang/sql/ast.hob b/hobgoblin/src/output/lang/sql/ast.hob index 9a51e38..f5dad7d 100644 --- a/hobgoblin/src/output/lang/sql/ast.hob +++ b/hobgoblin/src/output/lang/sql/ast.hob @@ -1,3 +1,5 @@ +// == Statements == + sum SqlStatement { variant SqlCreateTableStatement; } @@ -5,6 +7,7 @@ sum SqlStatement { struct SqlCreateTableStatement { field name: SqlIdentifier; field columns: List[SqlColumnDefinition]; + field tableConstraints: List[SqlTableConstraint]; } struct SqlColumnDefinition { @@ -12,6 +15,18 @@ struct SqlColumnDefinition { field typeName: SqlIdentifier; } +// == Table constraints == + +sum SqlTableConstraint { + variant SqlPrimaryKeyConstraint; +} + +struct SqlPrimaryKeyConstraint { + field columns: List[SqlIdentifier]; +} + +// == Identifiers == + struct SqlIdentifier { field value: String; } -- cgit v1.2.3