@@ -58,11 +58,11 @@ public function getTables(?string $schema = null): array
58
58
59
59
$ tables = [];
60
60
foreach ($ result as $ row ) {
61
- $ table = new Table ();
62
- $ table -> name = (string ) $ row ->TABLE_NAME ;
63
- $ table -> schema = (string ) $ row ->TABLE_SCHEMA ;
64
- $ table -> isView = $ row ->TABLE_TYPE === 'VIEW ' ;
65
-
61
+ $ table = new Table (
62
+ name: (string ) $ row ->TABLE_NAME ,
63
+ schema: (string ) $ row ->TABLE_SCHEMA ,
64
+ isView: $ row ->TABLE_TYPE === 'VIEW ' ,
65
+ );
66
66
$ tables [$ table ->getUnescapedFqn ()] = $ table ;
67
67
}
68
68
return $ tables ;
@@ -81,17 +81,17 @@ public function getColumns(string $table, ?string $schema = null): array
81
81
foreach ($ query as $ row ) {
82
82
$ type = explode ('( ' , (string ) $ row ->Type );
83
83
84
- $ column = new Column ();
85
- $ column -> name = (string ) $ row ->Field ;
86
- $ column -> type = strtoupper ($ type [0 ]);
87
- $ column -> size = isset ($ type [1 ]) ? (int ) $ type [1 ] : null ;
88
- $ column -> default = $ row ->Default !== null ? (string ) $ row ->Default : null ;
89
- $ column -> isPrimary = $ row ->Key === 'PRI ' ;
90
- $ column -> isAutoincrement = $ row ->Extra === 'auto_increment ' ;
91
- $ column -> isUnsigned = (bool ) strstr ((string ) $ row ->Type , 'unsigned ' );
92
- $ column -> isNullable = $ row ->Null === 'YES ' ;
93
- $ column -> meta = [];
94
-
84
+ $ column = new Column (
85
+ name: (string ) $ row ->Field ,
86
+ type: strtoupper ($ type [0 ]),
87
+ size: isset ($ type [1 ]) ? (int ) $ type [1 ] : null ,
88
+ default: $ row ->Default !== null ? (string ) $ row ->Default : null ,
89
+ isPrimary: $ row ->Key === 'PRI ' ,
90
+ isAutoincrement: $ row ->Extra === 'auto_increment ' ,
91
+ isUnsigned: (bool ) strstr ((string ) $ row ->Type , 'unsigned ' ),
92
+ isNullable: $ row ->Null === 'YES ' ,
93
+ meta: [],
94
+ );
95
95
$ columns [$ column ->name ] = $ column ;
96
96
}
97
97
return $ columns ;
@@ -122,14 +122,14 @@ public function getForeignKeys(string $table, ?string $schema = null): array
122
122
/** @var array<string, ForeignKey> $keys */
123
123
$ keys = [];
124
124
foreach ($ result as $ row ) {
125
- $ foreignKey = new ForeignKey ();
126
- $ foreignKey -> name = (string ) $ row ->CONSTRAINT_NAME ;
127
- $ foreignKey -> schema = (string ) $ row ->CONSTRAINT_SCHEMA ;
128
- $ foreignKey -> column = (string ) $ row ->COLUMN_NAME ;
129
- $ foreignKey -> refTable = (string ) $ row ->REFERENCED_TABLE_NAME ;
130
- $ foreignKey -> refTableSchema = (string ) $ row ->REFERENCED_TABLE_SCHEMA ;
131
- $ foreignKey -> refColumn = (string ) $ row ->REFERENCED_COLUMN_NAME ;
132
-
125
+ $ foreignKey = new ForeignKey (
126
+ name: (string ) $ row ->CONSTRAINT_NAME ,
127
+ schema: (string ) $ row ->CONSTRAINT_SCHEMA ,
128
+ column: (string ) $ row ->COLUMN_NAME ,
129
+ refTable: (string ) $ row ->REFERENCED_TABLE_NAME ,
130
+ refTableSchema: (string ) $ row ->REFERENCED_TABLE_SCHEMA ,
131
+ refColumn: (string ) $ row ->REFERENCED_COLUMN_NAME ,
132
+ );
133
133
$ keys [$ foreignKey ->column ] = $ foreignKey ;
134
134
}
135
135
return $ keys ;
0 commit comments