diff --git a/app/controllers/api/database.php b/app/controllers/api/database.php
index 7199e000e3..8def227c96 100644
--- a/app/controllers/api/database.php
+++ b/app/controllers/api/database.php
@@ -941,6 +941,7 @@ App::post('/v1/database/collections/:collectionId/indexes')
$database
->setParam('type', DATABASE_TYPE_CREATE_INDEX)
+ ->setParam('collection', $collection)
->setParam('document', $index)
;
diff --git a/app/views/console/database/collection.phtml b/app/views/console/database/collection.phtml
index 8ea476e437..4486943a40 100644
--- a/app/views/console/database/collection.phtml
+++ b/app/views/console/database/collection.phtml
@@ -264,11 +264,14 @@ $logs = $this->getParam('logs', null);
- available
+ available
+ processing
+ failed
+ deleting
|
-
+
|
diff --git a/src/Appwrite/Utopia/Response/Model/Index.php b/src/Appwrite/Utopia/Response/Model/Index.php
index 23b46ebebe..ed291f064e 100644
--- a/src/Appwrite/Utopia/Response/Model/Index.php
+++ b/src/Appwrite/Utopia/Response/Model/Index.php
@@ -10,11 +10,11 @@ class Index extends Model
public function __construct()
{
$this
- ->addRule('$id', [
+ ->addRule('key', [
'type' => self::TYPE_STRING,
- 'description' => 'Index ID.',
+ 'description' => 'Index Key.',
'default' => '',
- 'example' => '',
+ 'example' => 'index1',
])
->addRule('type', [
'type' => self::TYPE_STRING,
@@ -22,6 +22,12 @@ class Index extends Model
'default' => '',
'example' => '',
])
+ ->addRule('status', [
+ 'type' => self::TYPE_STRING,
+ 'description' => 'Index status. Possible values: `available`, `processing`, `deleting`, or `failed`',
+ 'default' => '',
+ 'example' => 'string',
+ ])
->addRule('attributes', [
'type' => self::TYPE_STRING,
'description' => 'Index attributes.',
diff --git a/tests/e2e/Services/Database/DatabaseBase.php b/tests/e2e/Services/Database/DatabaseBase.php
index 778a6da3da..7541f874f7 100644
--- a/tests/e2e/Services/Database/DatabaseBase.php
+++ b/tests/e2e/Services/Database/DatabaseBase.php
@@ -120,24 +120,24 @@ trait DatabaseBase
'attributes' => ['title'],
]);
- // $this->assertEquals($titleIndex['headers']['status-code'], 201);
- // $this->assertEquals($titleIndex['body']['$id'], 'titleIndex');
- // $this->assertEquals($titleIndex['body']['type'], 'fulltext');
- // $this->assertCount(1, $titleIndex['body']['attributes']);
- // $this->assertEquals($titleIndex['body']['attributes'][0], 'title');
+ $this->assertEquals($titleIndex['headers']['status-code'], 201);
+ $this->assertEquals($titleIndex['body']['key'], 'titleIndex');
+ $this->assertEquals($titleIndex['body']['type'], 'fulltext');
+ $this->assertCount(1, $titleIndex['body']['attributes']);
+ $this->assertEquals($titleIndex['body']['attributes'][0], 'title');
- // // wait for database worker to create index
- // sleep(5);
+ // wait for database worker to create index
+ sleep(5);
- // $movies = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'], array_merge([
- // 'content-type' => 'application/json',
- // 'x-appwrite-project' => $this->getProject()['$id'],
- // 'x-appwrite-key' => $this->getProject()['apiKey']
- // ]), []);
+ $movies = $this->client->call(Client::METHOD_GET, '/database/collections/' . $data['moviesId'], array_merge([
+ 'content-type' => 'application/json',
+ 'x-appwrite-project' => $this->getProject()['$id'],
+ 'x-appwrite-key' => $this->getProject()['apiKey']
+ ]), []);
- // $this->assertIsArray($movies['body']['indexes']);
- // $this->assertCount(1, $movies['body']['indexes']);
- // $this->assertEquals($movies['body']['indexes'][0]['$id'], $titleIndex['body']['$id']);
+ $this->assertIsArray($movies['body']['indexes']);
+ $this->assertCount(1, $movies['body']['indexes']);
+ $this->assertEquals($movies['body']['indexes'][0]['key'], $titleIndex['body']['key']);
return $data;
}
diff --git a/tests/e2e/Services/Database/DatabaseCustomServerTest.php b/tests/e2e/Services/Database/DatabaseCustomServerTest.php
index e02a61ebfe..486d55813c 100644
--- a/tests/e2e/Services/Database/DatabaseCustomServerTest.php
+++ b/tests/e2e/Services/Database/DatabaseCustomServerTest.php
@@ -179,7 +179,7 @@ class DatabaseCustomServerTest extends Scope
$this->assertEquals($collection['body']['attributes'][1]['key'], $lastName['body']['key']);
$this->assertEquals($collection['body']['attributes'][2]['key'], $unneeded['body']['key']);
$this->assertCount(1, $collection['body']['indexes']);
- $this->assertEquals($collection['body']['indexes'][0]['$id'], $index['body']['$id']);
+ $this->assertEquals($collection['body']['indexes'][0]['key'], $index['body']['key']);
// Delete attribute
$this->client->call(Client::METHOD_DELETE, '/database/collections/' . $actors ['body']['$id'] . '/attributes/' . $unneededId, array_merge([
@@ -198,12 +198,12 @@ class DatabaseCustomServerTest extends Scope
$this->assertIsArray($collection['body']['attributes']);
$this->assertCount(2, $collection['body']['attributes']);
- $this->assertEquals($collection['body']['attributes'][0]['$id'], $firstName['body']['$id']);
- $this->assertEquals($collection['body']['attributes'][1]['$id'], $lastName['body']['$id']);
+ $this->assertEquals($collection['body']['attributes'][0]['key'], $firstName['body']['key']);
+ $this->assertEquals($collection['body']['attributes'][1]['key'], $lastName['body']['key']);
return [
'collectionId' => $actors['body']['$id'],
- 'indexId' => $index['body']['$id'],
+ 'indexId' => $index['body']['key'],
];
}
/**
|