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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user