1
0
Fork 0
mirror of synced 2024-10-05 12:43:13 +13:00

Migration Fixes

This commit is contained in:
Bradley Schofield 2024-02-17 11:29:49 +00:00
parent 14a243cc37
commit f6f8816e2b
3 changed files with 31 additions and 34 deletions

View file

@ -113,7 +113,7 @@ const APP_KEY_ACCCESS = 24 * 60 * 60; // 24 hours
const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours const APP_USER_ACCCESS = 24 * 60 * 60; // 24 hours
const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours const APP_CACHE_UPDATE = 24 * 60 * 60; // 24 hours
const APP_CACHE_BUSTER = 329; const APP_CACHE_BUSTER = 329;
const APP_VERSION_STABLE = '1.4.13'; const APP_VERSION_STABLE = '1.5.0';
const APP_DATABASE_ATTRIBUTE_EMAIL = 'email'; const APP_DATABASE_ATTRIBUTE_EMAIL = 'email';
const APP_DATABASE_ATTRIBUTE_ENUM = 'enum'; const APP_DATABASE_ATTRIBUTE_ENUM = 'enum';
const APP_DATABASE_ATTRIBUTE_IP = 'ip'; const APP_DATABASE_ATTRIBUTE_IP = 'ip';

10
composer.lock generated
View file

@ -5019,16 +5019,16 @@
}, },
{ {
"name": "squizlabs/php_codesniffer", "name": "squizlabs/php_codesniffer",
"version": "3.8.1", "version": "3.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git",
"reference": "14f5fff1e64118595db5408e946f3a22c75807f7" "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/14f5fff1e64118595db5408e946f3a22c75807f7", "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/d63cee4890a8afaf86a22e51ad4d97c91dd4579b",
"reference": "14f5fff1e64118595db5408e946f3a22c75807f7", "reference": "d63cee4890a8afaf86a22e51ad4d97c91dd4579b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -5095,7 +5095,7 @@
"type": "open_collective" "type": "open_collective"
} }
], ],
"time": "2024-01-11T20:47:48+00:00" "time": "2024-02-16T15:06:51+00:00"
}, },
{ {
"name": "swoole/ide-helper", "name": "swoole/ide-helper",

View file

@ -47,6 +47,7 @@ class V20 extends Migration
Console::info('Migrating Collections'); Console::info('Migrating Collections');
$this->migrateCollections(); $this->migrateCollections();
if ($this->project->getInternalId() !== 'console') {
Console::info('Migrating Functions'); Console::info('Migrating Functions');
$this->migrateFunctions(); $this->migrateFunctions();
@ -55,6 +56,7 @@ class V20 extends Migration
Console::info('Migrating Buckets'); Console::info('Migrating Buckets');
$this->migrateBuckets(); $this->migrateBuckets();
}
Console::info('Migrating Documents'); Console::info('Migrating Documents');
$this->forEachDocument([$this, 'fixDocument']); $this->forEachDocument([$this, 'fixDocument']);
@ -75,18 +77,15 @@ class V20 extends Migration
}; };
// Support database array type migration (user collections) // Support database array type migration (user collections)
foreach ( if ($collectionType === 'projects') {
$this->documentsIterator('attributes', [ foreach ($this->documentsIterator('attributes', [
Query::equal('array', [true]), Query::equal('array', [true]),
]) as $attribute ]) as $attribute) {
) {
$foundIndex = false; $foundIndex = false;
foreach ( foreach ($this->documentsIterator('indexes', [
$this->documentsIterator('indexes', [
Query::equal('databaseInternalId', [$attribute['databaseInternalId']]), Query::equal('databaseInternalId', [$attribute['databaseInternalId']]),
Query::equal('collectionInternalId', [$attribute['collectionInternalId']]), Query::equal('collectionInternalId', [$attribute['collectionInternalId']]),
]) as $index ]) as $index) {
) {
if (in_array($attribute['key'], $index['attributes'])) { if (in_array($attribute['key'], $index['attributes'])) {
$this->projectDB->deleteIndex($index['collectionId'], $index['$id']); $this->projectDB->deleteIndex($index['collectionId'], $index['$id']);
$foundIndex = true; $foundIndex = true;
@ -96,6 +95,7 @@ class V20 extends Migration
$this->projectDB->updateAttribute($attribute['collectionInternalId'], $attribute['key'], $attribute['type']); $this->projectDB->updateAttribute($attribute['collectionInternalId'], $attribute['key'], $attribute['type']);
} }
} }
}
$collections = $this->collections[$collectionType]; $collections = $this->collections[$collectionType];
foreach ($collections as $collection) { foreach ($collections as $collection) {
@ -323,7 +323,6 @@ class V20 extends Migration
*/ */
protected function createInfMetric(string $metric, int $value): void protected function createInfMetric(string $metric, int $value): void
{ {
try { try {
/** /**
* Creating inf metric * Creating inf metric
@ -351,7 +350,6 @@ class V20 extends Migration
*/ */
protected function migrateUsageMetrics(string $from, string $to): void protected function migrateUsageMetrics(string $from, string $to): void
{ {
/** /**
* inf metric * inf metric
*/ */
@ -411,7 +409,6 @@ class V20 extends Migration
*/ */
private function migrateFunctions(): void private function migrateFunctions(): void
{ {
$this->migrateUsageMetrics('deployment.$all.storage.size', 'deployments.storage'); $this->migrateUsageMetrics('deployment.$all.storage.size', 'deployments.storage');
$this->migrateUsageMetrics('builds.$all.compute.total', 'builds'); $this->migrateUsageMetrics('builds.$all.compute.total', 'builds');
$this->migrateUsageMetrics('builds.$all.compute.time', 'builds.compute'); $this->migrateUsageMetrics('builds.$all.compute.time', 'builds.compute');