@@ -79,6 +79,7 @@ class ModelLexer implements Lexer
79
79
'unsigned ' => 'unsigned ' ,
80
80
'usecurrent ' => 'useCurrent ' ,
81
81
'always ' => 'always ' ,
82
+ 'unique ' => 'unique ' ,
82
83
];
83
84
84
85
public function analyze (array $ tokens ): array
@@ -137,27 +138,27 @@ private function buildColumn(string $name, string $definition)
137
138
foreach ($ tokens as $ token ) {
138
139
$ parts = explode (': ' , $ token );
139
140
$ value = $ parts [0 ];
140
- $ attributes = $ parts [1 ] ?? null ;
141
141
142
142
if ($ value === 'id ' ) {
143
143
$ data_type = 'id ' ;
144
144
} elseif (isset (self ::$ dataTypes [strtolower ($ value )])) {
145
+ $ attributes = $ parts [1 ] ?? null ;
145
146
$ data_type = self ::$ dataTypes [strtolower ($ value )];
146
147
if (!empty ($ attributes )) {
147
148
$ attributes = explode (', ' , $ attributes );
148
149
}
149
150
}
150
151
151
152
if (isset (self ::$ modifiers [strtolower ($ value )])) {
152
- if (empty ($ attributes )) {
153
+ $ modifierAttributes = $ parts [1 ] ?? null ;
154
+ if (empty ($ modifierAttributes )) {
153
155
$ modifiers [] = self ::$ modifiers [strtolower ($ value )];
154
156
} else {
155
- $ modifiers [] = [self ::$ modifiers [strtolower ($ value )] => $ attributes ];
156
- $ attributes = [];
157
+ $ modifiers [] = [self ::$ modifiers [strtolower ($ value )] => $ modifierAttributes ];
157
158
}
158
159
}
159
160
}
160
161
161
162
return new Column ($ name , $ data_type , $ modifiers , $ attributes ?? []);
162
163
}
163
- }
164
+ }
0 commit comments