Merge pull request #10273 from ArnabChatterjee20k/dat-600

updated database type to grids and legacy
This commit is contained in:
Jake Barnby 2025-08-06 12:12:58 +00:00 committed by GitHub
commit 4ff90783f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 22 additions and 22 deletions

24
composer.lock generated
View file

@ -4042,16 +4042,16 @@
},
{
"name": "utopia-php/migration",
"version": "0.14.0",
"version": "0.14.1",
"source": {
"type": "git",
"url": "https://github.com/utopia-php/migration.git",
"reference": "f9a7e87413b82975dbd87b7850aec2543aeac7ee"
"reference": "34bb7c487b00cefa35fddcff0621e704a23f4ebf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/f9a7e87413b82975dbd87b7850aec2543aeac7ee",
"reference": "f9a7e87413b82975dbd87b7850aec2543aeac7ee",
"url": "https://api.github.com/repos/utopia-php/migration/zipball/34bb7c487b00cefa35fddcff0621e704a23f4ebf",
"reference": "34bb7c487b00cefa35fddcff0621e704a23f4ebf",
"shasum": ""
},
"require": {
@ -4092,9 +4092,9 @@
],
"support": {
"issues": "https://github.com/utopia-php/migration/issues",
"source": "https://github.com/utopia-php/migration/tree/0.14.0"
"source": "https://github.com/utopia-php/migration/tree/0.14.1"
},
"time": "2025-08-05T12:33:09+00:00"
"time": "2025-08-06T11:46:44+00:00"
},
{
"name": "utopia-php/orchestration",
@ -4859,16 +4859,16 @@
"packages-dev": [
{
"name": "appwrite/sdk-generator",
"version": "0.41.28",
"version": "0.41.29",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "8eace11070264c62c8da3c69498fb8dc98fcfaf7"
"reference": "4af563f3b0879747efc8434eb8ed8bf97e75039f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/8eace11070264c62c8da3c69498fb8dc98fcfaf7",
"reference": "8eace11070264c62c8da3c69498fb8dc98fcfaf7",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/4af563f3b0879747efc8434eb8ed8bf97e75039f",
"reference": "4af563f3b0879747efc8434eb8ed8bf97e75039f",
"shasum": ""
},
"require": {
@ -4904,9 +4904,9 @@
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"support": {
"issues": "https://github.com/appwrite/sdk-generator/issues",
"source": "https://github.com/appwrite/sdk-generator/tree/0.41.28"
"source": "https://github.com/appwrite/sdk-generator/tree/0.41.29"
},
"time": "2025-08-01T11:06:30+00:00"
"time": "2025-08-04T04:34:45+00:00"
},
{
"name": "doctrine/annotations",

View file

@ -46,7 +46,7 @@ class V23 extends Migration
// since required + default can't be used together
// so first creating the attribute then bulk updating the attribute
$this->createAttributeFromCollection($this->dbForProject, 'databases', 'type');
$this->dbForProject->updateDocuments('databases', new Document(['type' => 'sql']));
$this->dbForProject->updateDocuments('databases', new Document(['type' => 'legacy']));
}
}

View file

@ -81,7 +81,7 @@ class Create extends Action
->param('databaseId', '', new CustomId(), 'Unique Id. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can\'t start with a special char. Max length is 36 chars.')
->param('name', '', new Text(128), 'Database name. Max length: 128 chars.')
->param('enabled', true, new Boolean(), 'Is the database enabled? When set to \'disabled\', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.', true)
->param('type', 'sql', new WhiteList(['sql','nosql']), 'Database type.', true)
->param('type', 'grids', new WhiteList(['grids','legacy']), 'Database type.', true)
->inject('response')
->inject('dbForProject')
->inject('queueForEvents')

View file

@ -43,8 +43,8 @@ class Database extends Model
->addRule('type', [
'type' => self::TYPE_STRING,
'description' => 'Database type.',
'default' => 'sql',
'example' => 'sql',
'default' => 'grids',
'example' => 'grids',
])
;
}

View file

@ -32,7 +32,7 @@ trait DatabasesBase
$this->assertNotEmpty($database['body']['$id']);
$this->assertEquals(201, $database['headers']['status-code']);
$this->assertEquals('Test Database', $database['body']['name']);
$this->assertEquals('sql', $database['body']['type']);
$this->assertEquals('grids', $database['body']['type']);
// testing to create a database with type
$database2 = $this->client->call(Client::METHOD_POST, '/databases', [
@ -53,12 +53,12 @@ trait DatabasesBase
], [
'databaseId' => ID::unique(),
'name' => 'Test Database with type',
'type' => 'nosql'
'type' => 'legacy'
]);
$this->assertNotEmpty($database2['body']['$id']);
$this->assertEquals(201, $database2['headers']['status-code']);
$this->assertEquals('Test Database with type', $database2['body']['name']);
$this->assertEquals('nosql', $database2['body']['type']);
$this->assertEquals('legacy', $database2['body']['type']);
// cleanup(for database2)
$databaseId = $database2['body']['$id'];

View file

@ -32,7 +32,7 @@ trait DatabasesBase
$this->assertNotEmpty($database['body']['$id']);
$this->assertEquals(201, $database['headers']['status-code']);
$this->assertEquals('Test Database', $database['body']['name']);
$this->assertEquals('sql', $database['body']['type']);
$this->assertEquals('grids', $database['body']['type']);
// testing to create a database with type
$database2 = $this->client->call(Client::METHOD_POST, '/databases', [
@ -53,12 +53,12 @@ trait DatabasesBase
], [
'databaseId' => ID::unique(),
'name' => 'Test Database with type',
'type' => 'nosql'
'type' => 'legacy'
]);
$this->assertNotEmpty($database2['body']['$id']);
$this->assertEquals(201, $database2['headers']['status-code']);
$this->assertEquals('Test Database with type', $database2['body']['name']);
$this->assertEquals('nosql', $database2['body']['type']);
$this->assertEquals('legacy', $database2['body']['type']);
// cleanup(for database2)
$databaseId = $database2['body']['$id'];