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()}");
|
$this->projectDB->setNamespace("_{$this->project->getInternalId()}");
|
||||||
|
|
||||||
switch ($id) {
|
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':
|
case 'sessions':
|
||||||
try {
|
try {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -69,6 +69,35 @@ class V21 extends Migration
|
||||||
Console::warning("'accessedAt' from {$id}: {$th->getMessage()}");
|
Console::warning("'accessedAt' from {$id}: {$th->getMessage()}");
|
||||||
}
|
}
|
||||||
break;
|
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':
|
case 'schedules':
|
||||||
// Create data attribute
|
// Create data attribute
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -14,6 +14,7 @@ class V18 extends Filter
|
||||||
|
|
||||||
$parsedResponse = match($model) {
|
$parsedResponse = match($model) {
|
||||||
Response::MODEL_FUNCTION => $this->parseFunction($content),
|
Response::MODEL_FUNCTION => $this->parseFunction($content),
|
||||||
|
Response::MODEL_EXECUTION => $this->parseExecution($content),
|
||||||
Response::MODEL_PROJECT => $this->parseProject($content),
|
Response::MODEL_PROJECT => $this->parseProject($content),
|
||||||
default => $parsedResponse,
|
default => $parsedResponse,
|
||||||
};
|
};
|
||||||
|
@ -21,6 +22,12 @@ class V18 extends Filter
|
||||||
return $parsedResponse;
|
return $parsedResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function parseExecution(array $content)
|
||||||
|
{
|
||||||
|
unset($content['scheduledAt']);
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
protected function parseFunction(array $content)
|
protected function parseFunction(array $content)
|
||||||
{
|
{
|
||||||
unset($content['scopes']);
|
unset($content['scopes']);
|
||||||
|
|
|
@ -50,6 +50,32 @@ class V18Test extends TestCase
|
||||||
$this->assertEquals($expected, $result);
|
$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
|
public function projectProvider(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
|
Loading…
Reference in a new issue