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

@ -10,15 +10,14 @@ struct Module {
struct User {
id int [primary; sql: serial]
age int
name string [nonull]
is_customer bool
age int [unique: 'user']
name string [unique]
is_customer bool [unique: 'user']
skipped_string string [skip]
}
fn main() {
db := sqlite.connect(':memory:') or { panic(err) }
db.exec('drop table if exists User')
sql db {
create table Module
}
@ -40,6 +39,10 @@ fn main() {
select from Module where id == 1
}
sql db {
drop table Module
}
eprintln(modul)
mysql()