|
@@ 1225-1247 (lines=23) @@
|
| 1222 |
|
* @group 2782 |
| 1223 |
|
* @group 6654 |
| 1224 |
|
*/ |
| 1225 |
|
public function testComparatorShouldAddCommentToLegacyJsonArrayType() |
| 1226 |
|
{ |
| 1227 |
|
if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { |
| 1228 |
|
$this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); |
| 1229 |
|
} |
| 1230 |
|
|
| 1231 |
|
$this->_conn->executeQuery( |
| 1232 |
|
'CREATE TABLE json_array_test (id INT NOT NULL, parameters JSON NOT NULL, PRIMARY KEY(id))' |
| 1233 |
|
); |
| 1234 |
|
|
| 1235 |
|
$table = new Table('json_array_test'); |
| 1236 |
|
$table->addColumn('id', 'integer'); |
| 1237 |
|
$table->addColumn('parameters', 'json_array'); |
| 1238 |
|
$table->setPrimaryKey(['id']); |
| 1239 |
|
|
| 1240 |
|
$comparator = new Comparator(); |
| 1241 |
|
$tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); |
| 1242 |
|
|
| 1243 |
|
$this->_sm->dropTable('json_array_test'); |
| 1244 |
|
|
| 1245 |
|
self::assertInstanceOf(TableDiff::class, $tableDiff); |
| 1246 |
|
self::assertSame(['comment'], $tableDiff->changedColumns['parameters']->changedProperties); |
| 1247 |
|
} |
| 1248 |
|
|
| 1249 |
|
/** |
| 1250 |
|
* @group 2782 |
|
@@ 1253-1275 (lines=23) @@
|
| 1250 |
|
* @group 2782 |
| 1251 |
|
* @group 6654 |
| 1252 |
|
*/ |
| 1253 |
|
public function testComparatorShouldReturnAllChangesWhenUsingLegacyJsonArrayType() |
| 1254 |
|
{ |
| 1255 |
|
if ( ! $this->_sm->getDatabasePlatform()->hasNativeJsonType()) { |
| 1256 |
|
$this->markTestSkipped('This test is only supported on platforms that have native JSON type.'); |
| 1257 |
|
} |
| 1258 |
|
|
| 1259 |
|
$this->_conn->executeQuery( |
| 1260 |
|
'CREATE TABLE json_array_test (id INT NOT NULL, parameters JSON DEFAULT NULL, PRIMARY KEY(id))' |
| 1261 |
|
); |
| 1262 |
|
|
| 1263 |
|
$table = new Table('json_array_test'); |
| 1264 |
|
$table->addColumn('id', 'integer'); |
| 1265 |
|
$table->addColumn('parameters', 'json_array'); |
| 1266 |
|
$table->setPrimaryKey(['id']); |
| 1267 |
|
|
| 1268 |
|
$comparator = new Comparator(); |
| 1269 |
|
$tableDiff = $comparator->diffTable($this->_sm->listTableDetails('json_array_test'), $table); |
| 1270 |
|
|
| 1271 |
|
$this->_sm->dropTable('json_array_test'); |
| 1272 |
|
|
| 1273 |
|
self::assertInstanceOf(TableDiff::class, $tableDiff); |
| 1274 |
|
self::assertSame(['notnull', 'comment'], $tableDiff->changedColumns['parameters']->changedProperties); |
| 1275 |
|
} |
| 1276 |
|
|
| 1277 |
|
/** |
| 1278 |
|
* @group 2782 |