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

orm: fix unique fields (#11045)

This commit is contained in:
Louis Schmieder
2021-08-06 05:21:59 +02:00
committed by GitHub
parent 490dec222f
commit a4358a6801
3 changed files with 81 additions and 2 deletions

View File

@ -355,7 +355,7 @@ pub fn orm_table_gen(table string, para string, defaults bool, def_unique_len in
stmt += ' NOT NULL'
}
if is_unique {
mut f := 'UNIQUE KEY($para$field.name$para'
mut f := 'UNIQUE($para$field.name$para'
if ctyp == 'TEXT' && def_unique_len > 0 {
if unique_len > 0 {
f += '($unique_len)'