1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

orm: add unique fields & add drop table stmt (#9684)

This commit is contained in:
Louis Schmieder
2021-04-11 23:57:25 +02:00
committed by GitHub
parent b0b3c51658
commit 67d8639917
6 changed files with 101 additions and 7 deletions

View File

@@ -146,6 +146,25 @@ fn (mut p Parser) sql_stmt() ast.SqlStmt {
pos: typ_pos
}
}
} else if n == 'drop' {
kind = .drop
table := p.check_name()
if table != 'table' {
p.error('expected `table` got `$table`')
return ast.SqlStmt{}
}
typ := p.parse_type()
typ_pos := p.tok.position()
p.check(.rcbr)
return ast.SqlStmt{
db_expr: db_expr
kind: kind
pos: pos.extend(p.prev_tok.position())
table_expr: ast.TypeNode{
typ: typ
pos: typ_pos
}
}
}
mut inserted_var_name := ''
mut table_type := ast.Type(0)