mirror of
https://github.com/appwrite/appwrite
synced 2026-05-24 09:28:40 +00:00
updates
This commit is contained in:
parent
350d72eb1f
commit
030cdf3cc8
4 changed files with 18 additions and 14 deletions
2
.gitmodules
vendored
2
.gitmodules
vendored
|
|
@ -1,4 +1,4 @@
|
||||||
[submodule "app/console"]
|
[submodule "app/console"]
|
||||||
path = app/console
|
path = app/console
|
||||||
url = https://github.com/appwrite/console
|
url = https://github.com/appwrite/console
|
||||||
branch = 3.2.16
|
branch = 1.5.x
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
"utopia-php/image": "0.6.*",
|
"utopia-php/image": "0.6.*",
|
||||||
"utopia-php/locale": "0.4.*",
|
"utopia-php/locale": "0.4.*",
|
||||||
"utopia-php/logger": "0.3.*",
|
"utopia-php/logger": "0.3.*",
|
||||||
"utopia-php/messaging": "0.8.*",
|
"utopia-php/messaging": "0.9.*",
|
||||||
"utopia-php/migration": "0.3.*",
|
"utopia-php/migration": "0.3.*",
|
||||||
"utopia-php/orchestration": "0.9.*",
|
"utopia-php/orchestration": "0.9.*",
|
||||||
"utopia-php/platform": "0.5.*",
|
"utopia-php/platform": "0.5.*",
|
||||||
|
|
|
||||||
|
|
@ -71,26 +71,29 @@ class V20 extends Migration
|
||||||
'console' => 'console',
|
'console' => 'console',
|
||||||
default => 'projects',
|
default => 'projects',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$databases = $this->projectDB->find('databases', []);
|
||||||
|
foreach ($databases as $database) {
|
||||||
|
var_dump($database);
|
||||||
|
}
|
||||||
|
|
||||||
$collections = $this->collections[$collectionType];
|
$collections = $this->collections[$collectionType];
|
||||||
foreach ($collections as $collection) {
|
foreach ($collections as $collection) {
|
||||||
$id = $collection['$id'];
|
$id = $collection['$id'];
|
||||||
|
|
||||||
Console::log("Migrating Collection \"{$id}\"");
|
Console::log("Migrating Collection \"{$id}\"");
|
||||||
|
|
||||||
$this->projectDB->setNamespace("_{$this->project->getInternalId()}");
|
$this->projectDB->setNamespace("_$internalProjectId");
|
||||||
$modifiedAttr = [];
|
|
||||||
|
// Support database array type migration
|
||||||
foreach ($collection['attributes'] ?? [] as $attribute) {
|
foreach ($collection['attributes'] ?? [] as $attribute) {
|
||||||
if ($attribute['type'] === 'string' && $attribute['array'] === true) {
|
if ($attribute['array'] === true) {
|
||||||
$this->projectDB->updateAttribute($id, $attribute['$id']);
|
foreach ($collection['indexes'] ?? [] as $index) {
|
||||||
$modifiedAttr[] = $attribute['$id'];
|
if (in_array($attribute['$id'], $index['attributes'])) {
|
||||||
}
|
$this->projectDB->deleteIndex($id, $index['$id']);
|
||||||
}
|
}
|
||||||
if (!empty($modified)) {
|
|
||||||
foreach ($collection['indexes'] ?? [] as $index) {
|
|
||||||
$foundIndexes = array_intersect($modifiedAttr, $index['attributes']);
|
|
||||||
if ($foundIndexes) {
|
|
||||||
$this->projectDB->deleteIndex($id, $index['$id']);
|
|
||||||
}
|
}
|
||||||
|
$this->projectDB->updateAttribute($id, $attribute['$id'], Database::VAR_STRING);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,6 +93,7 @@ class Migrate extends Action
|
||||||
// TODO: Iterate through all project DBs
|
// TODO: Iterate through all project DBs
|
||||||
/** @var Database $projectDB */
|
/** @var Database $projectDB */
|
||||||
$projectDB = $getProjectDB($project);
|
$projectDB = $getProjectDB($project);
|
||||||
|
var_dump($project);
|
||||||
$migration
|
$migration
|
||||||
->setProject($project, $projectDB, $dbForConsole)
|
->setProject($project, $projectDB, $dbForConsole)
|
||||||
->setPDO($register->get('db', true))
|
->setPDO($register->get('db', true))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue