Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Adds DynamoDB Adapter #333

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
Change internal id type to string
  • Loading branch information
ajwad-shaikh committed Oct 8, 2023
commit 3f7bd05a8067ae1ea28d740c93445adb3b5e578c
6 changes: 3 additions & 3 deletions src/Database/Adapter/DynamoDB.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public function createCollection(string $name, array $attributes = [], array $in
$attributeDefinitions = [
[
'AttributeName' => '_id',
'AttributeType' => DynamoDB::VAR_NUMBER,
'AttributeType' => DynamoDB::VAR_STRING,
],
[
'AttributeName' => '_uid',
Expand Down Expand Up @@ -356,7 +356,7 @@ public function deleteAttribute(string $collection, string $id): bool
foreach ($items as $item) {
$updateParams = [
'TableName' => "{$this->getNamespace()}_{$collection}",
'Key' => ['_id' => [ 'N' => $item['_id']]], // Replace with your primary key
'Key' => ['_id' => [ 'S' => $item['_id']]], // Replace with your primary key
'UpdateExpression' => "REMOVE {$id}",
];
try {
Expand Down Expand Up @@ -394,7 +394,7 @@ public function renameAttribute(string $collection, string $old, string $new): b
}
$updateParams = [
'TableName' => "{$this->getNamespace()}_{$collection}",
'Key' => ['_id' => [ 'N' => $item['_id']['N']]], // Replace with your primary key
'Key' => ['_id' => [ 'S' => $item['_id']['S']]], // Replace with your primary key
'UpdateExpression' => "SET {$new} = {$oldItemValue} REMOVE {$old}",
];
try {
Expand Down