|
@@ 144-151 (lines=8) @@
|
| 141 |
|
* |
| 142 |
|
* @return Closure |
| 143 |
|
*/ |
| 144 |
|
protected function primaryString(string $name): Closure |
| 145 |
|
{ |
| 146 |
|
return function (Table $table, MigrationContextInterface $context) use ($name) { |
| 147 |
|
$length = $context->getModelSchemas()->getAttributeLength($context->getModelClass(), $name); |
| 148 |
|
$table->addColumn($name, Type::STRING)->setLength($length)->setNotnull(true); |
| 149 |
|
$table->setPrimaryKey([$name]); |
| 150 |
|
}; |
| 151 |
|
} |
| 152 |
|
|
| 153 |
|
/** |
| 154 |
|
* @param string $name |
|
@@ 194-200 (lines=7) @@
|
| 191 |
|
* |
| 192 |
|
* @return Closure |
| 193 |
|
*/ |
| 194 |
|
protected function string(string $name): Closure |
| 195 |
|
{ |
| 196 |
|
return function (Table $table, MigrationContextInterface $context) use ($name) { |
| 197 |
|
$length = $context->getModelSchemas()->getAttributeLength($context->getModelClass(), $name); |
| 198 |
|
$table->addColumn($name, Type::STRING)->setLength($length)->setNotnull(true); |
| 199 |
|
}; |
| 200 |
|
} |
| 201 |
|
|
| 202 |
|
/** |
| 203 |
|
* @param string $name |
|
@@ 207-213 (lines=7) @@
|
| 204 |
|
* |
| 205 |
|
* @return Closure |
| 206 |
|
*/ |
| 207 |
|
protected function nullableString(string $name): Closure |
| 208 |
|
{ |
| 209 |
|
return function (Table $table, MigrationContextInterface $context) use ($name) { |
| 210 |
|
$length = $context->getModelSchemas()->getAttributeLength($context->getModelClass(), $name); |
| 211 |
|
$table->addColumn($name, Type::STRING)->setLength($length)->setNotnull(false); |
| 212 |
|
}; |
| 213 |
|
} |
| 214 |
|
|
| 215 |
|
/** |
| 216 |
|
* @param string $name |