File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -348,6 +348,30 @@ public static function convertCodeToType($code)
348348 * @return string
349349 */
350350 public function getSQLDefinition ()
351+ {
352+ $ definition = $ this ->buildTypeWithLength ();
353+
354+ if (!$ this ->isNullable ()) {
355+ $ definition .= ' NOT NULL ' ;
356+ }
357+ if ($ this ->getDefault () !== null ) {
358+ $ definition .= ' DEFAULT ' . $ this ->getDefault ();
359+ }
360+
361+ if (in_array ($ this ->getType (), self ::CHARACTER_SET_TYPES , true )) {
362+ $ definition .= ' CHARACTER SET ' . ($ this ->isLatin () ? 'LATIN ' : 'UNICODE ' );
363+ }
364+
365+ return $ definition ;
366+ }
367+
368+ /**
369+ * generates type with length
370+ * most of the types just append it, but some of them are complex and some have no length...
371+ * used here and in i/e lib
372+ * @return string
373+ */
374+ public function buildTypeWithLength ()
351375 {
352376 $ type = $ this ->getType ();
353377 $ definition = $ type ;
@@ -364,17 +388,6 @@ public function getSQLDefinition()
364388 }
365389 }
366390
367- if (!$ this ->isNullable ()) {
368- $ definition .= ' NOT NULL ' ;
369- }
370- if ($ this ->getDefault () !== null ) {
371- $ definition .= ' DEFAULT ' . $ this ->getDefault ();
372- }
373-
374- if (in_array ($ this ->getType (), self ::CHARACTER_SET_TYPES , true )) {
375- $ definition .= ' CHARACTER SET ' . ($ this ->isLatin () ? 'LATIN ' : 'UNICODE ' );
376- }
377-
378391 return $ definition ;
379392 }
380393
You can’t perform that action at this time.
0 commit comments