@@ -21,7 +21,7 @@ discard block |
||
| 21 | 21 | |
| 22 | 22 | $list = []; |
| 23 | 23 | |
| 24 | - foreach ($migrations as $table=>$item){ |
|
| 24 | + foreach ($migrations as $table=>$item) { |
|
| 25 | 25 | $list[] = strtolower($table); |
| 26 | 26 | } |
| 27 | 27 | |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | echo 'Toplam : '.count($dbtables).' Table'; |
| 31 | 31 | echo PHP_EOL; |
| 32 | 32 | |
| 33 | - foreach ($dbtables as $dbtablekey=>$dbtable){ |
|
| 33 | + foreach ($dbtables as $dbtablekey=>$dbtable) { |
|
| 34 | 34 | |
| 35 | 35 | $dbtablekey = $dbtablekey+1; |
| 36 | 36 | |
@@ -39,34 +39,34 @@ discard block |
||
| 39 | 39 | $dbtable = ucfirst($dbtable); |
| 40 | 40 | $makeDirectory = $directory.''.DIRECTORY_SEPARATOR.''.$dbtable; |
| 41 | 41 | |
| 42 | - if(!file_exists($makeDirectory)){ |
|
| 43 | - files()->makeDirectory($makeDirectory,0755,true); |
|
| 44 | - $exist=false; |
|
| 42 | + if (!file_exists($makeDirectory)) { |
|
| 43 | + files()->makeDirectory($makeDirectory, 0755, true); |
|
| 44 | + $exist = false; |
|
| 45 | 45 | } |
| 46 | - else{ |
|
| 47 | - $exist=true; |
|
| 46 | + else { |
|
| 47 | + $exist = true; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | $migrationName = time().'_'.$dbtable.''; |
| 51 | 51 | |
| 52 | - if($exist===false){ |
|
| 52 | + if ($exist===false) { |
|
| 53 | 53 | |
| 54 | - $content = $this->getContentFile($this->getStubPath().''.DIRECTORY_SEPARATOR.'pullCreate.stub',[ |
|
| 54 | + $content = $this->getContentFile($this->getStubPath().''.DIRECTORY_SEPARATOR.'pullCreate.stub', [ |
|
| 55 | 55 | 'className' => $dbtable, |
| 56 | 56 | 'informations' => $informations |
| 57 | 57 | ]); |
| 58 | 58 | |
| 59 | - $contentResult = files()->put($makeDirectory.''.DIRECTORY_SEPARATOR.''.$migrationName.'.php',$content); |
|
| 59 | + $contentResult = files()->put($makeDirectory.''.DIRECTORY_SEPARATOR.''.$migrationName.'.php', $content); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
| 63 | - if(isset($contentResult) && $contentResult!==false){ |
|
| 63 | + if (isset($contentResult) && $contentResult!==false) { |
|
| 64 | 64 | echo $dbtablekey.'- '.$migrationName.' ---> Ok'; |
| 65 | 65 | } |
| 66 | - elseif($exist){ |
|
| 66 | + elseif ($exist) { |
|
| 67 | 67 | echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)'; |
| 68 | 68 | } |
| 69 | - else{ |
|
| 69 | + else { |
|
| 70 | 70 | echo $dbtablekey.'- '.$migrationName.' ---> Fail'; |
| 71 | 71 | } |
| 72 | 72 | |
@@ -101,46 +101,46 @@ discard block |
||
| 101 | 101 | |
| 102 | 102 | $list = []; |
| 103 | 103 | |
| 104 | - foreach ($columns as $key=>$data){ |
|
| 104 | + foreach ($columns as $key=>$data) { |
|
| 105 | 105 | |
| 106 | - $data['Type'] = rtrim(str_replace('unsigned','',$data['Type'])); |
|
| 106 | + $data['Type'] = rtrim(str_replace('unsigned', '', $data['Type'])); |
|
| 107 | 107 | |
| 108 | 108 | $field = $data['Field']; |
| 109 | 109 | $list[] = '$wizard->name(\''.$field.'\')'; |
| 110 | 110 | $list[] = '->'.$this->getColumnTransformers($data['Type']).''; |
| 111 | 111 | |
| 112 | 112 | //default block |
| 113 | - if(!is_null($data['Default'])){ |
|
| 113 | + if (!is_null($data['Default'])) { |
|
| 114 | 114 | $default = $data['Default']; |
| 115 | - $list[] = '->default(\''.$default.'\')'; |
|
| 115 | + $list[] = '->default(\''.$default.'\')'; |
|
| 116 | 116 | } |
| 117 | 117 | |
| 118 | - $getIndex = $this->getIndexInformation($indexes,$data['Field']); |
|
| 118 | + $getIndex = $this->getIndexInformation($indexes, $data['Field']); |
|
| 119 | 119 | |
| 120 | 120 | //unique block |
| 121 | - if($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY'){ |
|
| 121 | + if ($getIndex['Non_unique']=='0' && $getIndex['Key_name']!=='PRIMARY') { |
|
| 122 | 122 | $indexName = $getIndex['Key_name']; |
| 123 | - $list[] = '->unique(\''.$indexName.'\')'; |
|
| 123 | + $list[] = '->unique(\''.$indexName.'\')'; |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | //index block |
| 127 | - if($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY'){ |
|
| 127 | + if ($getIndex['Non_unique']=='1' && $getIndex['Key_name']!=='PRIMARY') { |
|
| 128 | 128 | $columnName = $getIndex['Column_name']; |
| 129 | 129 | $indexName = $getIndex['Key_name']; |
| 130 | 130 | |
| 131 | - if(count($multipleIndexes[$indexName])==1){ |
|
| 131 | + if (count($multipleIndexes[$indexName])==1) { |
|
| 132 | 132 | $list[] = '->index(\''.$indexName.'\')'; |
| 133 | 133 | } |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | //comment block |
| 137 | - if(strlen($data['Comment'])>0){ |
|
| 137 | + if (strlen($data['Comment'])>0) { |
|
| 138 | 138 | $comment = $data['Comment']; |
| 139 | 139 | $list[] = '->comment(\''.$comment.'\')'; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | //auto increment block |
| 143 | - if($data['Extra']=='auto_increment'){ |
|
| 143 | + if ($data['Extra']=='auto_increment') { |
|
| 144 | 144 | $list[] = '->auto_increment()'; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -155,39 +155,39 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | //table indexes |
| 157 | 157 | foreach ($multipleIndexes as $indexName=>$values) { |
| 158 | - if(count($values)>1){ |
|
| 159 | - $values = '\''.implode('\',\'',$values).'\''; |
|
| 158 | + if (count($values)>1) { |
|
| 159 | + $values = '\''.implode('\',\'', $values).'\''; |
|
| 160 | 160 | $list[] = ' $wizard->table()->indexes(\''.$indexName.'\',['.$values.']); |
| 161 | 161 | '; |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - if(count($foreignKeys)){ |
|
| 165 | + if (count($foreignKeys)) { |
|
| 166 | 166 | |
| 167 | 167 | $constraintName = $foreignKeys['CONSTRAINT_NAME']; |
| 168 | 168 | $key = $foreignKeys['COLUMN_NAME']; |
| 169 | 169 | $referenceTable = $foreignKeys['REFERENCED_TABLE_NAME']; |
| 170 | 170 | $referenceColumn = $foreignKeys['REFERENCED_COLUMN_NAME']; |
| 171 | 171 | |
| 172 | - if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){ |
|
| 172 | + if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') { |
|
| 173 | 173 | $list[] = ' $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\'); |
| 174 | 174 | '; |
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - if($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT'){ |
|
| 177 | + if ($foreignKeys['UPDATE_RULE']!=='RESTRICT' && $foreignKeys['DELETE_RULE']=='RESTRICT') { |
|
| 178 | 178 | $rule = $foreignKeys['UPDATE_RULE']; |
| 179 | 179 | $list[] = ' $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onUpdate()->'.strtolower($rule).'(); |
| 180 | 180 | '; |
| 181 | 181 | } |
| 182 | 182 | |
| 183 | - if($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT'){ |
|
| 183 | + if ($foreignKeys['UPDATE_RULE']=='RESTRICT' && $foreignKeys['DELETE_RULE']!=='RESTRICT') { |
|
| 184 | 184 | $rule = $foreignKeys['DELETE_RULE']; |
| 185 | 185 | $list[] = ' $wizard->table()->foreign()->constraint(\''.$constraintName.'\')->key(\''.$key.'\')->references(\''.$referenceTable.'\',\''.$referenceColumn.'\')->onDelete()->'.strtolower($rule).'(); |
| 186 | 186 | '; |
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - return implode('',$list); |
|
| 190 | + return implode('', $list); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | /** |
@@ -198,43 +198,43 @@ discard block |
||
| 198 | 198 | */ |
| 199 | 199 | private function getColumnTransformers($column) |
| 200 | 200 | { |
| 201 | - if($column=='datetime'){ |
|
| 201 | + if ($column=='datetime') { |
|
| 202 | 202 | return 'datetime()'; |
| 203 | 203 | } |
| 204 | - elseif($column=='longtext'){ |
|
| 204 | + elseif ($column=='longtext') { |
|
| 205 | 205 | return 'longtext()'; |
| 206 | 206 | } |
| 207 | - elseif($column=='date'){ |
|
| 207 | + elseif ($column=='date') { |
|
| 208 | 208 | return 'date()'; |
| 209 | 209 | } |
| 210 | - elseif($column=='text'){ |
|
| 210 | + elseif ($column=='text') { |
|
| 211 | 211 | return 'text()'; |
| 212 | 212 | } |
| 213 | - elseif($column=='timestamp'){ |
|
| 213 | + elseif ($column=='timestamp') { |
|
| 214 | 214 | return 'timestamp()'; |
| 215 | 215 | } |
| 216 | - elseif($column=='mediumint'){ |
|
| 216 | + elseif ($column=='mediumint') { |
|
| 217 | 217 | return 'mediumint()'; |
| 218 | 218 | } |
| 219 | - elseif($column=='tinyint'){ |
|
| 219 | + elseif ($column=='tinyint') { |
|
| 220 | 220 | return 'tinyint()'; |
| 221 | 221 | } |
| 222 | - elseif($column=='float'){ |
|
| 222 | + elseif ($column=='float') { |
|
| 223 | 223 | return 'float()'; |
| 224 | 224 | } |
| 225 | - elseif($column=='mediumtext'){ |
|
| 225 | + elseif ($column=='mediumtext') { |
|
| 226 | 226 | return 'mediumtext()'; |
| 227 | 227 | } |
| 228 | - elseif($column=='mediumblob'){ |
|
| 228 | + elseif ($column=='mediumblob') { |
|
| 229 | 229 | return 'mediumblob()'; |
| 230 | 230 | } |
| 231 | - elseif($column=='blob'){ |
|
| 231 | + elseif ($column=='blob') { |
|
| 232 | 232 | return 'blob()'; |
| 233 | 233 | } |
| 234 | - elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){ |
|
| 234 | + elseif (preg_match('@enum.*\((.*?)\)@', $column, $enum)) { |
|
| 235 | 235 | return 'enum(['.$enum[1].'])'; |
| 236 | 236 | } |
| 237 | - else{ |
|
| 237 | + else { |
|
| 238 | 238 | return $column; |
| 239 | 239 | } |
| 240 | 240 | } |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | * @param $field |
| 247 | 247 | * @return void|mixed |
| 248 | 248 | */ |
| 249 | - private function getIndexInformation($index,$field) |
|
| 249 | + private function getIndexInformation($index, $field) |
|
| 250 | 250 | { |
| 251 | 251 | foreach ($index as $key=>$item) { |
| 252 | 252 | |
| 253 | - if($item['Column_name'] == $field){ |
|
| 253 | + if ($item['Column_name']==$field) { |
|
| 254 | 254 | return $index[$key]; |
| 255 | 255 | } |
| 256 | 256 | } |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | { |
| 270 | 270 | $list = []; |
| 271 | 271 | foreach ($index as $key=>$item) { |
| 272 | - if($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY'){ |
|
| 272 | + if ($item['Non_unique']==1 && $item['Key_name']!=='PRIMARY') { |
|
| 273 | 273 | $list[$item['Key_name']][] = $item['Column_name']; |
| 274 | 274 | } |
| 275 | 275 | } |
@@ -42,8 +42,7 @@ discard block |
||
| 42 | 42 | if(!file_exists($makeDirectory)){ |
| 43 | 43 | files()->makeDirectory($makeDirectory,0755,true); |
| 44 | 44 | $exist=false; |
| 45 | - } |
|
| 46 | - else{ |
|
| 45 | + } else{ |
|
| 47 | 46 | $exist=true; |
| 48 | 47 | } |
| 49 | 48 | |
@@ -62,11 +61,9 @@ discard block |
||
| 62 | 61 | |
| 63 | 62 | if(isset($contentResult) && $contentResult!==false){ |
| 64 | 63 | echo $dbtablekey.'- '.$migrationName.' ---> Ok'; |
| 65 | - } |
|
| 66 | - elseif($exist){ |
|
| 64 | + } elseif($exist){ |
|
| 67 | 65 | echo $dbtablekey.'- '.$migrationName.' ---> (Already Exist)'; |
| 68 | - } |
|
| 69 | - else{ |
|
| 66 | + } else{ |
|
| 70 | 67 | echo $dbtablekey.'- '.$migrationName.' ---> Fail'; |
| 71 | 68 | } |
| 72 | 69 | |
@@ -200,41 +197,29 @@ discard block |
||
| 200 | 197 | { |
| 201 | 198 | if($column=='datetime'){ |
| 202 | 199 | return 'datetime()'; |
| 203 | - } |
|
| 204 | - elseif($column=='longtext'){ |
|
| 200 | + } elseif($column=='longtext'){ |
|
| 205 | 201 | return 'longtext()'; |
| 206 | - } |
|
| 207 | - elseif($column=='date'){ |
|
| 202 | + } elseif($column=='date'){ |
|
| 208 | 203 | return 'date()'; |
| 209 | - } |
|
| 210 | - elseif($column=='text'){ |
|
| 204 | + } elseif($column=='text'){ |
|
| 211 | 205 | return 'text()'; |
| 212 | - } |
|
| 213 | - elseif($column=='timestamp'){ |
|
| 206 | + } elseif($column=='timestamp'){ |
|
| 214 | 207 | return 'timestamp()'; |
| 215 | - } |
|
| 216 | - elseif($column=='mediumint'){ |
|
| 208 | + } elseif($column=='mediumint'){ |
|
| 217 | 209 | return 'mediumint()'; |
| 218 | - } |
|
| 219 | - elseif($column=='tinyint'){ |
|
| 210 | + } elseif($column=='tinyint'){ |
|
| 220 | 211 | return 'tinyint()'; |
| 221 | - } |
|
| 222 | - elseif($column=='float'){ |
|
| 212 | + } elseif($column=='float'){ |
|
| 223 | 213 | return 'float()'; |
| 224 | - } |
|
| 225 | - elseif($column=='mediumtext'){ |
|
| 214 | + } elseif($column=='mediumtext'){ |
|
| 226 | 215 | return 'mediumtext()'; |
| 227 | - } |
|
| 228 | - elseif($column=='mediumblob'){ |
|
| 216 | + } elseif($column=='mediumblob'){ |
|
| 229 | 217 | return 'mediumblob()'; |
| 230 | - } |
|
| 231 | - elseif($column=='blob'){ |
|
| 218 | + } elseif($column=='blob'){ |
|
| 232 | 219 | return 'blob()'; |
| 233 | - } |
|
| 234 | - elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){ |
|
| 220 | + } elseif(preg_match('@enum.*\((.*?)\)@',$column,$enum)){ |
|
| 235 | 221 | return 'enum(['.$enum[1].'])'; |
| 236 | - } |
|
| 237 | - else{ |
|
| 222 | + } else{ |
|
| 238 | 223 | return $column; |
| 239 | 224 | } |
| 240 | 225 | } |
@@ -10,16 +10,16 @@ discard block |
||
| 10 | 10 | * @param $name |
| 11 | 11 | * @return string |
| 12 | 12 | */ |
| 13 | - protected function getNullableValue($nullable,$name) |
|
| 13 | + protected function getNullableValue($nullable, $name) |
|
| 14 | 14 | { |
| 15 | - $nullableValue=''; |
|
| 15 | + $nullableValue = ''; |
|
| 16 | 16 | |
| 17 | - if(isset($nullable[$name])){ |
|
| 18 | - if($nullable[$name]===false){ |
|
| 19 | - $nullableValue='NOT NULL'; |
|
| 17 | + if (isset($nullable[$name])) { |
|
| 18 | + if ($nullable[$name]===false) { |
|
| 19 | + $nullableValue = 'NOT NULL'; |
|
| 20 | 20 | } |
| 21 | - else{ |
|
| 22 | - $nullableValue='NULL'; |
|
| 21 | + else { |
|
| 22 | + $nullableValue = 'NULL'; |
|
| 23 | 23 | } |
| 24 | 24 | } |
| 25 | 25 | |
@@ -59,21 +59,21 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | protected function getValueWithIsset($name) |
| 61 | 61 | { |
| 62 | - $nameKey = array_search($name,$this->data['names']); |
|
| 62 | + $nameKey = array_search($name, $this->data['names']); |
|
| 63 | 63 | |
| 64 | 64 | $list = []; |
| 65 | - $list[] = $this->getNullableValue($this->data['nullable'],$name); |
|
| 65 | + $list[] = $this->getNullableValue($this->data['nullable'], $name); |
|
| 66 | 66 | $list[] = (isset($this->data['autoIncrement'][$name])) ? 'AUTO_INCREMENT' : ''; |
| 67 | 67 | $list[] = (isset($this->data['primaryKey'][$name])) ? 'PRIMARY KEY' : ''; |
| 68 | 68 | |
| 69 | - if($this->data['types'][$nameKey]=='timestamp' && !isset($this->data['default'][$nameKey])){ |
|
| 69 | + if ($this->data['types'][$nameKey]=='timestamp' && !isset($this->data['default'][$nameKey])) { |
|
| 70 | 70 | $this->data['default'][$name] = 'CURRENT_TIMESTAMP'; |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | - if($this->data['types'][$nameKey]!=='timestamp'){ |
|
| 73 | + if ($this->data['types'][$nameKey]!=='timestamp') { |
|
| 74 | 74 | $list[] = (isset($this->data['default'][$name])) ? ' DEFAULT "'.$this->data['default'][$name].'"' : ''; |
| 75 | 75 | } |
| 76 | - else{ |
|
| 76 | + else { |
|
| 77 | 77 | $list[] = (isset($this->data['default'][$name])) ? ' DEFAULT '.$this->data['default'][$name].'' : ''; |
| 78 | 78 | } |
| 79 | 79 | |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | protected function getUniqueValueList($name) |
| 91 | 91 | { |
| 92 | 92 | //get unique |
| 93 | - if(isset($this->data['unique'][$name])){ |
|
| 94 | - $this->data['uniqueValueList'][] = 'UNIQUE INDEX '.$this->data['unique'][$name]['value'].' ('.$name.' ASC)'; |
|
| 93 | + if (isset($this->data['unique'][$name])) { |
|
| 94 | + $this->data['uniqueValueList'][] = 'UNIQUE INDEX '.$this->data['unique'][$name]['value'].' ('.$name.' ASC)'; |
|
| 95 | 95 | } |
| 96 | 96 | } |
| 97 | 97 | |
@@ -101,8 +101,8 @@ discard block |
||
| 101 | 101 | protected function getIndexValueList($name) |
| 102 | 102 | { |
| 103 | 103 | //get index |
| 104 | - if(isset($this->data['index'][$name])){ |
|
| 105 | - $this->data['indexValueList'][] = 'INDEX '.$this->data['index'][$name]['value'].' ('.$name.')'; |
|
| 104 | + if (isset($this->data['index'][$name])) { |
|
| 105 | + $this->data['indexValueList'][] = 'INDEX '.$this->data['index'][$name]['value'].' ('.$name.')'; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | |
@@ -123,19 +123,19 @@ discard block |
||
| 123 | 123 | */ |
| 124 | 124 | protected function getCreateDefaultList() |
| 125 | 125 | { |
| 126 | - $list = []; |
|
| 126 | + $list = []; |
|
| 127 | 127 | |
| 128 | 128 | foreach ($this->data['names'] as $key=>$name) |
| 129 | 129 | { |
| 130 | 130 | list( |
| 131 | - $nullableValue,$autoIncrementValue, |
|
| 132 | - $primaryKeyValue,$defaultValue,$commentValue |
|
| 131 | + $nullableValue, $autoIncrementValue, |
|
| 132 | + $primaryKeyValue, $defaultValue, $commentValue |
|
| 133 | 133 | ) = $this->getValueWithIsset($name); |
| 134 | 134 | |
| 135 | 135 | //set index values |
| 136 | 136 | $this->setIndex($name); |
| 137 | 137 | |
| 138 | - $list[]=''.$name.' '.$this->data['types'][$key].' '.$nullableValue.' '.$defaultValue.' '.$primaryKeyValue.' '.$autoIncrementValue.' '.$commentValue.''; |
|
| 138 | + $list[] = ''.$name.' '.$this->data['types'][$key].' '.$nullableValue.' '.$defaultValue.' '.$primaryKeyValue.' '.$autoIncrementValue.' '.$commentValue.''; |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | return $list; |
@@ -146,18 +146,18 @@ discard block |
||
| 146 | 146 | */ |
| 147 | 147 | protected function getKeyList() |
| 148 | 148 | { |
| 149 | - $keyList = []; |
|
| 149 | + $keyList = []; |
|
| 150 | 150 | |
| 151 | 151 | //multiple indexes |
| 152 | - if(isset($this->data['index']['indexes'])){ |
|
| 152 | + if (isset($this->data['index']['indexes'])) { |
|
| 153 | 153 | |
| 154 | - foreach ($this->data['index']['indexes'] as $index_key=>$index_value){ |
|
| 154 | + foreach ($this->data['index']['indexes'] as $index_key=>$index_value) { |
|
| 155 | 155 | |
| 156 | 156 | $indexesCommentValue = (isset($index_value['comment'])) ? 'COMMENT "'.$index_value['comment'].'"' : ''; |
| 157 | 157 | |
| 158 | 158 | $keyType = (isset($index_value['type'])) ? ucfirst($index_value['type']) : 'KEY'; |
| 159 | 159 | |
| 160 | - $keyList[] = "".$keyType." ".$index_value['name']." (".implode(",",$index_value['value']).") ".$indexesCommentValue; |
|
| 160 | + $keyList[] = "".$keyType." ".$index_value['name']." (".implode(",", $index_value['value']).") ".$indexesCommentValue; |
|
| 161 | 161 | } |
| 162 | 162 | } |
| 163 | 163 | |
@@ -172,13 +172,13 @@ discard block |
||
| 172 | 172 | { |
| 173 | 173 | $list = []; |
| 174 | 174 | |
| 175 | - foreach ($reference as $constraint=>$values){ |
|
| 175 | + foreach ($reference as $constraint=>$values) { |
|
| 176 | 176 | |
| 177 | - $list[]=',CONSTRAINT '.$constraint.' FOREIGN KEY ('.$values['key'].') |
|
| 177 | + $list[] = ',CONSTRAINT '.$constraint.' FOREIGN KEY ('.$values['key'].') |
|
| 178 | 178 | REFERENCES '.$values['references']['table'].'('.$values['references']['field'].') '.$this->getOnProcess($values); |
| 179 | 179 | } |
| 180 | 180 | |
| 181 | - return implode (" ",$list); |
|
| 181 | + return implode(" ", $list); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | /** |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | */ |
| 187 | 187 | private function getOnProcess($referenceValue) |
| 188 | 188 | { |
| 189 | - if(isset($referenceValue['on']) && isset($referenceValue['onOption'])){ |
|
| 189 | + if (isset($referenceValue['on']) && isset($referenceValue['onOption'])) { |
|
| 190 | 190 | return ''.$referenceValue['on'].' '.strtoupper($referenceValue['onOption']).''; |
| 191 | 191 | } |
| 192 | 192 | |