Skip to content

🐛 Bug Report: Deletion of collection and recreating it fails and gives a duplication error #22

Closed
@Caryntjen

Description

@Caryntjen

👟 Reproduction steps
Collection TEST with same ID exists.
Deleting and creating collection gives error in the logs. The collection is succesfully deleted. But the creation fails.

    private var appwriteClient: Client = Client()
        .setEndpoint(APPWRITE_ENDPOINT)
        .setProject(APPWRITE_PROJECT)
        .setKey(APPWRITE_KEY)
        .setSelfSigned(false)
    val appwriteDatabase = Database(appwriteClient)
        
            appwriteDatabase.deleteCollection( "TEST")
            
        val collection: Collection = appwriteDatabase.createCollection(
            collectionId = "TEST",
            name =  "TEST",
            read = ["team:xxx"],
            write = ["team:xxx"],
            permission = "collection"

👍 Expected behavior
Deletion and creation should work. And once the deletion is executed, it should be possible to create a database with same name and id.

👎 Actual Behavior
Shows the following error in Appwrite where it complains about a dupliocate key.

[Error] Type: PDOException
[Error] Message: Duplicate key name '_index2'
[Error] File: @swoole-src/library/core/Database/PDOStatementProxy.php
[Error] Line: 64

🎲 Appwrite version
Version 0.12.1

💻 Operating system
Windows

🧱 Your Environment
Appwrite v0.12.1 - sdk-for-kotlin v0.2.5
Java v11
Kotlin v1.6.10

👀 Have you spent some time to check if this issue has been raised before?
I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
I have read the Code of Conduct

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions