diff --git a/src/Appwrite/Migration/Migration.php b/src/Appwrite/Migration/Migration.php index d47490e604..2d82b9c486 100644 --- a/src/Appwrite/Migration/Migration.php +++ b/src/Appwrite/Migration/Migration.php @@ -89,6 +89,7 @@ abstract class Migration '1.7.2' => 'V22', '1.7.3' => 'V22', '1.7.4' => 'V22', + '1.8.0' => 'V23' ]; /** diff --git a/src/Appwrite/Migration/Version/V23.php b/src/Appwrite/Migration/Version/V23.php new file mode 100644 index 0000000000..d54b6ddc87 --- /dev/null +++ b/src/Appwrite/Migration/Version/V23.php @@ -0,0 +1,61 @@ + null, + fn () => [] + ); + } + + Console::info('Migrating databases'); + $this->migrateDatabases(); + } + + /** + * Migrate Databases. + * + * @return void + * @throws Exception|Throwable + */ + private function migrateDatabases(): void + { + if ($this->project->getId() === 'console') { + return; + } + + // since required + default can't be used together + // so first creating the attribute then bulk updating the attribute + $this->dbForProject->createAttributes('databases', [new Document([ + '$id' => ID::custom('type'), + 'type' => Database::VAR_STRING, + 'size' => 128, + 'required' => true, + 'signed' => true, + 'array' => false, + 'filters' => [], + ])]); + $this->dbForProject->updateDocuments('databases', new Document(['$id' => 'type','type' => 'sql'])); + } + +}