Skip to content

Commit c968c7f

Browse files
feat: add ScyllaDB adapter support
- Add ScyllaDB adapter class with full database operations support - Add comprehensive test suite for ScyllaDB adapter - Add ScyllaDB services to docker-compose.yml - Update README with ScyllaDB connection example and specs
1 parent 5530801 commit c968c7f

File tree

4 files changed

+1279
-0
lines changed

4 files changed

+1279
-0
lines changed

README.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ Below is a list of supported databases, and their compatibly tested versions alo
5555
| Postgres || 13.0 |
5656
| MongoDB || 5.0 |
5757
| SQLite || 3.38 |
58+
| ScyllaDB || 5.2 |
5859

5960
` ✅ - supported `
6061

@@ -82,6 +83,16 @@ Below is a list of supported databases, and their compatibly tested versions alo
8283
- String max size is 2147483647 characters
8384
- Integer max size is 4294967295
8485

86+
#### ScyllaDB
87+
- ID max size can be 255 bytes
88+
- ID can only contain [^A-Za-z0-9] and symbols `_` `-`
89+
- Document can have unrestricted size
90+
- Collection can have unrestricted amount of attributes
91+
- Collection can have unrestricted amount of indexes
92+
- Index value can have unrestricted size
93+
- String max size is unrestricted
94+
- Integer max size is 2^63 - 1
95+
8596
## Usage
8697

8798
### Connecting to a Database
@@ -207,6 +218,32 @@ $cache = new Cache(new Memory()); // or use any cache adapter you wish
207218
$database = new Database(new SQLite($pdo), $cache);
208219
```
209220

221+
#### ScyllaDB
222+
223+
```php
224+
require_once __DIR__ . '/vendor/autoload.php';
225+
226+
use PDO;
227+
use Utopia\Database\Database;
228+
use Utopia\Cache\Cache;
229+
use Utopia\Cache\Adapter\Memory;
230+
use Utopia\Database\Adapter\ScyllaDB;
231+
232+
$dbHost = 'scylladb';
233+
$dbPort = '9042';
234+
$dbUser = 'root';
235+
$dbPass = 'password';
236+
237+
$pdo = new PDO("scylla:host={$dbHost};port={$dbPort}", $dbUser, $dbPass, ScyllaDB::getPDOAttributes());
238+
239+
$cache = new Cache(new Memory());
240+
$database = new Database(new ScyllaDB($pdo), $cache);
241+
242+
$database
243+
->setDatabase('myapp')
244+
->setNamespace('myapp_ns');
245+
```
246+
210247
#### MongoDB
211248

212249
```php

docker-compose.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,5 +130,38 @@ services:
130130
networks:
131131
- database
132132

133+
scylladb:
134+
image: scylladb/scylla:5.2
135+
container_name: utopia-scylladb
136+
restart: unless-stopped
137+
networks:
138+
- database
139+
ports:
140+
- "8710:9042"
141+
command: --smp 1 --memory 750M --overprovisioned 1 --api-address 0.0.0.0
142+
healthcheck:
143+
test: ["CMD-SHELL", "nodetool status"]
144+
interval: 30s
145+
timeout: 10s
146+
retries: 5
147+
148+
scylladb-mirror:
149+
image: scylladb/scylla:5.2
150+
container_name: utopia-scylladb-mirror
151+
restart: unless-stopped
152+
networks:
153+
- database
154+
ports:
155+
- "8711:9042"
156+
command: --smp 1 --memory 750M --overprovisioned 1 --api-address 0.0.0.0
157+
healthcheck:
158+
test: ["CMD-SHELL", "nodetool status"]
159+
interval: 30s
160+
timeout: 10s
161+
retries: 5
162+
133163
networks:
134164
database:
165+
166+
volumes:
167+
appwrite-scylladb:

0 commit comments

Comments
 (0)