Apply migrations properly
This commit is contained in:
parent
c6ab0d8523
commit
51c163a42f
4 changed files with 62 additions and 30 deletions
|
@ -48,36 +48,6 @@ class V16 extends Migration
|
|||
$this->projectDB->setNamespace("_{$this->project->getInternalId()}");
|
||||
|
||||
switch ($id) {
|
||||
case 'executions':
|
||||
try {
|
||||
/**
|
||||
* Create 'scheduledAt' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduledAt');
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduledAt' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* Create 'scheduleInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduleInternalId');
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduleInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* Create 'scheduleId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduleId');
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduleId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'sessions':
|
||||
try {
|
||||
/**
|
||||
|
|
|
@ -69,6 +69,35 @@ class V21 extends Migration
|
|||
Console::warning("'accessedAt' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
break;
|
||||
case 'executions':
|
||||
try {
|
||||
/**
|
||||
* Create 'scheduledAt' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduledAt');
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduledAt' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* Create 'scheduleInternalId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduleInternalId');
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduleInternalId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
try {
|
||||
/**
|
||||
* Create 'scheduleId' attribute
|
||||
*/
|
||||
$this->createAttributeFromCollection($this->projectDB, $id, 'scheduleId');
|
||||
} catch (\Throwable $th) {
|
||||
Console::warning("'scheduleId' from {$id}: {$th->getMessage()}");
|
||||
}
|
||||
|
||||
break;
|
||||
case 'schedules':
|
||||
// Create data attribute
|
||||
try {
|
||||
|
|
|
@ -14,6 +14,7 @@ class V18 extends Filter
|
|||
|
||||
$parsedResponse = match($model) {
|
||||
Response::MODEL_FUNCTION => $this->parseFunction($content),
|
||||
Response::MODEL_EXECUTION => $this->parseExecution($content),
|
||||
Response::MODEL_PROJECT => $this->parseProject($content),
|
||||
default => $parsedResponse,
|
||||
};
|
||||
|
@ -21,6 +22,12 @@ class V18 extends Filter
|
|||
return $parsedResponse;
|
||||
}
|
||||
|
||||
protected function parseExecution(array $content)
|
||||
{
|
||||
unset($content['scheduledAt']);
|
||||
return $content;
|
||||
}
|
||||
|
||||
protected function parseFunction(array $content)
|
||||
{
|
||||
unset($content['scopes']);
|
||||
|
|
|
@ -50,6 +50,32 @@ class V18Test extends TestCase
|
|||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
|
||||
public function executionProvider(): array
|
||||
{
|
||||
return [
|
||||
'remove scheduledAt' => [
|
||||
[
|
||||
'scheduledAt' => '2024-07-13T09:00:00.000Z',
|
||||
],
|
||||
[
|
||||
]
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @dataProvider executionProvider
|
||||
*/
|
||||
public function testExecution(array $content, array $expected): void
|
||||
{
|
||||
$model = Response::MODEL_EXECUTION;
|
||||
|
||||
$result = $this->filter->parse($content, $model);
|
||||
|
||||
$this->assertEquals($expected, $result);
|
||||
}
|
||||
|
||||
public function projectProvider(): array
|
||||
{
|
||||
return [
|
||||
|
|
Loading…
Reference in a new issue