Merge pull request #6011 from appwrite/revert-some-migrations

Revert some migrations
This commit is contained in:
Jake Barnby 2023-08-22 10:16:12 -04:00 committed by GitHub
commit 6b92a590e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 66 deletions

View file

@ -228,7 +228,7 @@ App::post('/v1/functions')
'active' => false,
]))
);
$function->setAttribute('scheduleId', $schedule->getId());
$function->setAttribute('scheduleInternalId', $schedule->getInternalId());
@ -854,7 +854,7 @@ App::get('/v1/functions/:functionId/deployments/:deploymentId/download')
->setContentType('application/gzip')
->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)) . ' GMT') // 45 days cache
->addHeader('X-Peak', \memory_get_peak_usage())
->addHeader('Content-Disposition', 'attachment; filename="'.$deploymentId.'.tar.gz"')
->addHeader('Content-Disposition', 'attachment; filename="' . $deploymentId . '.tar.gz"')
;
$size = $deviceFunctions->getFileSize($path);

View file

@ -45,7 +45,7 @@ App::post('/v1/proxy/rules')
if ($domain === $mainDomain || $domain === 'localhost' || $domain === APP_HOSTNAME_INTERNAL) {
throw new Exception(Exception::GENERAL_ARGUMENT_INVALID, 'This domain name is not allowed for security reasons.');
}
$document = $dbForConsole->findOne('rules', [
Query::equal('domain', [$domain]),
]);

29
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "83427d18095b42c274d2bd6eb302e4aa",
"content-hash": "a05c1fe23b14b9f08345c9648540c304",
"packages": [
{
"name": "adhocore/jwt",
@ -3227,16 +3227,16 @@
},
{
"name": "utopia-php/vcs",
"version": "dev-feat-clone-commit-hash",
"version": "0.2.0",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/vcs.git",
"reference": "5ed5d1685b3b714d6f20f7922ab4f5f5188313ee"
"reference": "ec388e056fec8675b5fe1fc7a4f77e4dc3f328cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/vcs/zipball/5ed5d1685b3b714d6f20f7922ab4f5f5188313ee",
"reference": "5ed5d1685b3b714d6f20f7922ab4f5f5188313ee",
"url": "https://api.github.com/repos/utopia-php/vcs/zipball/ec388e056fec8675b5fe1fc7a4f77e4dc3f328cf",
"reference": "ec388e056fec8675b5fe1fc7a4f77e4dc3f328cf",
"shasum": ""
},
"require": {
@ -3270,9 +3270,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/vcs/issues",
"source": "https://github.com/utopia-php/vcs/tree/feat-clone-commit-hash"
"source": "https://github.com/utopia-php/vcs/tree/0.2.0"
},
"time": "2023-08-21T09:02:54+00:00"
"time": "2023-08-21T10:59:48+00:00"
},
{
"name": "utopia-php/websocket",
@ -6069,18 +6069,9 @@
"time": "2023-07-26T07:16:09+00:00"
}
],
"aliases": [
{
"package": "utopia-php/vcs",
"version": "dev-feat-clone-commit-hash",
"alias": "0.1.99",
"alias_normalized": "0.1.99.0"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {
"utopia-php/vcs": 20
},
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
@ -6104,5 +6095,5 @@
"platform-overrides": {
"php": "8.0"
},
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.3.0"
}

View file

@ -29,9 +29,6 @@ class V19 extends Migration
Console::log('Migrating Project: ' . $this->project->getAttribute('name') . ' (' . $this->project->getId() . ')');
$this->projectDB->setNamespace("_{$this->project->getInternalId()}");
$this->alterPermissionIndex('_metadata');
$this->alterUidType('_metadata');
Console::info('Migrating Databases');
$this->migrateDatabases();
@ -74,14 +71,9 @@ class V19 extends Migration
$databaseTable = "database_{$database->getInternalId()}";
$this->alterPermissionIndex($databaseTable);
$this->alterUidType($databaseTable);
foreach ($this->documentsIterator($databaseTable) as $collection) {
$collectionTable = "{$databaseTable}_collection_{$collection->getInternalId()}";
Console::log("Migrating Collections of {$collectionTable} {$collection->getId()} ({$collection->getAttribute('name')})");
$this->alterPermissionIndex($collectionTable);
$this->alterUidType($collectionTable);
}
}
}
@ -529,10 +521,6 @@ class V19 extends Migration
default:
break;
}
if (!in_array($id, ['files', 'collections'])) {
$this->alterPermissionIndex($id);
$this->alterUidType($id);
}
usleep(50000);
}
@ -659,36 +647,6 @@ class V19 extends Migration
return $document;
}
protected function alterPermissionIndex($collectionName): void
{
// try {
// // $table = "`{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}_perms`";
// // $this->pdo->prepare("
// // ALTER TABLE {$table}
// // DROP INDEX `_permission`,
// // ADD INDEX `_permission` (`_permission`, `_type`, `_document`);
// // ")->execute();
// $this->projectDB->deleteIndex($collectionName, '_permission', ['_permission', '_type', '_document']);
// $this->projectDB->createIndex($collectionName, '_permission', Database::INDEX_KEY, ['_permission', '_type', '_document'])
// } catch (\Throwable $th) {
// Console::warning($th->getMessage());
// }
}
protected function alterUidType($collectionName): void
{
// try {
// // $table = "`{$this->projectDB->getDefaultDatabase()}`.`_{$this->project->getInternalId()}_{$collectionName}`";
// // $this->pdo->prepare("
// // ALTER TABLE {$table}
// // CHANGE COLUMN `_uid` `_uid` VARCHAR(255) NOT NULL ;
// // ")->execute();
// $this->projectDB->updateAttribute($collectionName, '_uid', type: 'string', size: 255, required: true);
// } catch (\Throwable $th) {
// Console::warning($th->getMessage());
// }
}
/**
* Migrating all Bucket tables.
*
@ -701,8 +659,6 @@ class V19 extends Migration
foreach ($this->documentsIterator('buckets') as $bucket) {
$id = "bucket_{$bucket->getInternalId()}";
Console::log("Migrating Bucket {$id} {$bucket->getId()} ({$bucket->getAttribute('name')})");
$this->alterPermissionIndex($id);
$this->alterUidType($id);
try {
$this->createAttributeFromCollection($this->projectDB, $id, 'bucketInternalId', 'files');