Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
315 commits
Select commit Hold shift + click to select a range
8b169a4
Fix SQLite tests
abnegate Aug 19, 2024
088d549
Fix missing silent calls in mirror
abnegate Aug 19, 2024
bad0ea5
Lint
abnegate Aug 19, 2024
67bf1fe
Merge pull request #439 from utopia-php/feat-atomic-updates
abnegate Aug 21, 2024
6eba4de
Merge pull request #442 from utopia-php/feat-resizing-string-attributes
abnegate Aug 30, 2024
46fa933
Merge pull request #444 from utopia-php/feat-resizing-string-attributes
abnegate Aug 30, 2024
6e2547a
Merge pull request #445 from utopia-php/feat-resizing-string-attributes
abnegate Aug 30, 2024
4be46b9
Merge pull request #446 from utopia-php/fix-deadlock
abnegate Sep 2, 2024
b6b7b54
Merge pull request #448 from utopia-php/fix-add-escapes-for-rename
abnegate Sep 10, 2024
32ab2f7
Lint
abnegate Sep 12, 2024
b3cf767
Add rollbacks on bad state
abnegate Sep 13, 2024
12b634a
Fix metadata becoming desynchronised when updating relationship names
PineappleIOnic Oct 4, 2024
50b30f8
Postgres has a max table/index name length of 63 bytes
PineappleIOnic Oct 4, 2024
4fd5587
Make findOne return empty document instead of false when no matches a…
PineappleIOnic Sep 17, 2024
7fc5402
Update src/Database/Database.php
PineappleIOnic Oct 7, 2024
923260a
Run Linter
PineappleIOnic Oct 7, 2024
feddc8e
Merge pull request #452 from utopia-php/fix-0.53.x-relationship-renaming
abnegate Oct 8, 2024
c483ca3
Merge remote-tracking branch 'origin/0.53.x' into feat-migrations
abnegate Oct 14, 2024
238883a
Exception simplification
abnegate Oct 14, 2024
9105080
Remove redundant get document
abnegate Oct 14, 2024
fde3478
Lint/check fixes
abnegate Oct 14, 2024
790b870
Fix merge
abnegate Oct 14, 2024
68f5bf6
Fix tests
abnegate Oct 14, 2024
74d7f8d
Fix cache not flushed on db delete
abnegate Oct 14, 2024
e06001b
Fix upgrade read on source/dest mirror
abnegate Oct 14, 2024
ec47a5e
Fix max allowed packet on mirror
abnegate Oct 14, 2024
58c7c68
Improve delegation
abnegate Oct 15, 2024
6639898
Fix spelling
abnegate Oct 15, 2024
a9de51b
Add redis mirror
abnegate Oct 15, 2024
30e470f
Use mirror cache for mirror db
abnegate Oct 15, 2024
781b421
Lint
abnegate Oct 15, 2024
651cb4f
Fix SQLite tests
abnegate Oct 15, 2024
b63c999
Fix order of operations issues
abnegate Oct 15, 2024
8bb5793
Fix mongo tests
abnegate Oct 15, 2024
78f0e9d
Bail out of commit if no active transaction
abnegate Oct 15, 2024
efd0f4e
Fix stan
abnegate Oct 15, 2024
7c15e2b
max query fix
fogelito Oct 15, 2024
172ca1a
Merge pull request #464 from utopia-php/0.53.x-max-query-size
abnegate Oct 16, 2024
fa10d5f
Allow skipping check for relationship existence
abnegate Oct 16, 2024
f4f9297
Merge pull request #465 from utopia-php/feat-allow-unrelated
abnegate Oct 16, 2024
9d0d950
Add not found exception
abnegate Oct 17, 2024
40b804e
Fix stan
abnegate Oct 17, 2024
b462b31
Merge remote-tracking branch 'origin/0.53.x' into feat-migrations
abnegate Oct 22, 2024
5b9462f
Add log dumps
abnegate Oct 22, 2024
7bd224a
Debug
abnegate Oct 22, 2024
b6ddece
Merge branch '0.53.x' into feat-findone-update-0.53.x
PineappleIOnic Oct 31, 2024
19969d2
Merge pull request #453 from utopia-php/feat-findone-update-0.53.x
abnegate Oct 31, 2024
df57463
Question?
fogelito Oct 31, 2024
89376bd
Merge remote-tracking branch 'origin/0.53.x' into feat-not-found-exce…
abnegate Nov 1, 2024
5b86dcf
Merge pull request #462 from utopia-php/feat-batch-update
abnegate Nov 1, 2024
616aa2f
Merge pull request #447 from utopia-php/feat-batch-delete
abnegate Nov 1, 2024
84558a6
Fix tests
abnegate Nov 1, 2024
39550cb
Rollback in transaction
abnegate Nov 4, 2024
7c2d68a
Merge branch '0.53.x' into feat-not-found-exception
abnegate Nov 4, 2024
83bd339
Merge pull request #466 from utopia-php/feat-not-found-exception
abnegate Nov 4, 2024
afb9e96
Min/max date validation based on adapter limits
abnegate Nov 4, 2024
4068d0c
Merge pull request #468 from utopia-php/fix-date-validation
abnegate Nov 4, 2024
a98a71b
Validate date
fogelito Nov 4, 2024
0b24787
lint
fogelito Nov 4, 2024
184ba52
revert lock
fogelito Nov 4, 2024
4a367eb
return null
fogelito Nov 4, 2024
2952a8f
lint
fogelito Nov 4, 2024
f716bcc
Merge pull request #469 from utopia-php/fix-date-encoding
abnegate Nov 5, 2024
bbfbf23
Don't throw on deleteAttribute if column doesn't exist
PineappleIOnic Nov 5, 2024
d148eba
Add transaction exception
abnegate Nov 5, 2024
315947a
Handle possible implicit commit
abnegate Nov 5, 2024
6c10f97
Reset counter to 0 only if commit succeeded
abnegate Nov 5, 2024
d64ce93
Savepoints for nested transactions
abnegate Nov 5, 2024
3b2b22e
Remove savepoints from postgres
abnegate Nov 5, 2024
160110f
Issue raw rollback to be certain no transactions are active
abnegate Nov 5, 2024
6f9b602
Throw rollback exception if max attempts reached
abnegate Nov 5, 2024
7b52365
5ms sleep
abnegate Nov 5, 2024
1158f91
Fix stan
abnegate Nov 5, 2024
8d1b7dc
Prepared statements for savepoints
abnegate Nov 5, 2024
a7e5de2
Merge pull request #471 from utopia-php/fix-transactions
abnegate Nov 5, 2024
a32165c
Get connection id
fogelito Nov 5, 2024
ca07a57
Remove comment
fogelito Nov 5, 2024
872012b
chore: update utopia-php/cache to 0.11.0
basert Nov 5, 2024
b52d944
Merge pull request #473 from utopia-php/update-cache-0.11.0
christyjacob4 Nov 5, 2024
a211131
Reset transaction count on retry loop failure
abnegate Nov 6, 2024
4ed35fd
Dummy
abnegate Nov 6, 2024
d9f85c6
Revert "Dummy"
abnegate Nov 6, 2024
2ed56d0
Merge pull request #474 from utopia-php/fix-transactions
abnegate Nov 6, 2024
3b4b249
Ensure values is array
abnegate Nov 6, 2024
c575e50
Ensure method is string
abnegate Nov 6, 2024
9fe3211
Add tests
abnegate Nov 6, 2024
7383ca9
Revert "Add tests"
abnegate Nov 6, 2024
b7110d5
Reapply "Add tests"
abnegate Nov 6, 2024
6661edf
Merge pull request #475 from utopia-php/fix-query-type-error
abnegate Nov 6, 2024
3357657
Revert "Question?"
abnegate Nov 6, 2024
cf9ba5a
Make bulk document deletes support all queries
PineappleIOnic Nov 6, 2024
9079460
Merge branch '0.53.x' into 0.53-improve-bkdeletes-queries
PineappleIOnic Nov 6, 2024
4688aef
Merge remote-tracking branch 'origin/0.53.x' into feat-migrations
abnegate Nov 6, 2024
55bfbfc
Implement support for all queries on bulk document updates
PineappleIOnic Nov 6, 2024
48a7ede
Address Comments
PineappleIOnic Nov 6, 2024
2ec40d7
Run Linter and fix PHPStan
PineappleIOnic Nov 6, 2024
c40d320
Add improved validation
PineappleIOnic Nov 6, 2024
6985884
Merge pull request #476 from utopia-php/0.53-improve-bkdeletes-queries
abnegate Nov 6, 2024
a23aec2
Update index order
abnegate Nov 6, 2024
ee47263
Merge branch '0.53.x' into 0.53-improve-blkupdate-queries
PineappleIOnic Nov 6, 2024
ad8f67a
Merge remote-tracking branch 'origin/0.53.x' into feat-migrations
abnegate Nov 6, 2024
2041770
Fix comment
fogelito Nov 6, 2024
90b8016
Fix infinite loop with bulk queries
PineappleIOnic Nov 6, 2024
07e3e5a
Merge pull request #477 from utopia-php/0.53-improve-blkupdate-queries
abnegate Nov 6, 2024
13eb1db
Merge branch '0.53.x' of github.com:utopia-php/database into connecti…
fogelito Nov 6, 2024
e014f9f
Add tests, fix formatting and postgres error code
PineappleIOnic Nov 7, 2024
f9321e7
Format and fix PHPStan
PineappleIOnic Nov 7, 2024
44ea79a
Merge pull request #472 from utopia-php/connection-id
abnegate Nov 7, 2024
6dde7ef
composer
shimonewman Nov 7, 2024
b593787
Merge remote-tracking branch 'origin/feat-migrations' into feat-migra…
shimonewman Nov 7, 2024
5af02bf
composer
shimonewman Nov 7, 2024
88b1975
composer
shimonewman Nov 7, 2024
9d5faac
composer
shimonewman Nov 7, 2024
31571bd
composer
shimonewman Nov 7, 2024
439655a
Merge branch '0.53.x' into feat-migrations
abnegate Nov 8, 2024
895176b
Merge pull request #437 from utopia-php/feat-migrations
abnegate Nov 8, 2024
529ac35
Address Comments
PineappleIOnic Nov 8, 2024
7a65d4d
Merge branch '0.53.x' into 0.53.x-success-on-missing-attribute-delete
PineappleIOnic Nov 8, 2024
10ce467
Add missing method in mirror
PineappleIOnic Nov 8, 2024
5c93bd3
Address Comments
PineappleIOnic Nov 8, 2024
4895188
Merge pull request #470 from utopia-php/0.53.x-success-on-missing-att…
abnegate Nov 8, 2024
562f52c
Fix message
abnegate Nov 8, 2024
c6ed011
Duplicate attributes
fogelito Nov 10, 2024
634c07a
Add void return value
fogelito Nov 10, 2024
9610307
lint
fogelito Nov 10, 2024
4c7127f
Double check
fogelito Nov 10, 2024
b7b879b
Fix tests
fogelito Nov 10, 2024
a171f5e
Fix unit tests
fogelito Nov 10, 2024
358aae9
adapter getIndexKeys
fogelito Nov 11, 2024
9f6a930
Remove orders check
fogelito Nov 11, 2024
91a0835
Is migrating
fogelito Nov 11, 2024
dbe87e7
Line feed
fogelito Nov 11, 2024
2c01fea
isMigrating
fogelito Nov 11, 2024
82acc1c
phpstan
fogelito Nov 11, 2024
075ab1d
Update create attribute logic
abnegate Nov 12, 2024
b0126cc
Add default param
abnegate Nov 12, 2024
e43f8ee
Merge pull request #478 from utopia-php/fix-index-validation
abnegate Nov 12, 2024
285bbfc
Update Bulk Document events to use document
PineappleIOnic Nov 12, 2024
692eeee
Add tests fix silent events
PineappleIOnic Nov 12, 2024
22af097
Fix missing test
PineappleIOnic Nov 12, 2024
e47e5c5
add test
fogelito Nov 12, 2024
d909e76
sharedTables index
fogelito Nov 12, 2024
7f264cb
Postgress
fogelito Nov 12, 2024
744ff4a
Merge pull request #480 from utopia-php/0.53.x-tenant-indexes
abnegate Nov 12, 2024
76470a9
Merge branch '0.53.x' of github.com:utopia-php/database into 0.53.x-a…
fogelito Nov 12, 2024
2e6ae59
Merge pull request #479 from utopia-php/0.53-fix-bulk-events
abnegate Nov 13, 2024
ef1d903
Unset length
fogelito Nov 13, 2024
c630f34
remove comments
fogelito Nov 13, 2024
a5623f9
remove comments
fogelito Nov 13, 2024
0e1bf18
stopOnFailure
fogelito Nov 13, 2024
73f9e5f
remove var_dump
fogelito Nov 13, 2024
1a4020e
formatting
fogelito Nov 13, 2024
5c50d1f
revert lock
fogelito Nov 13, 2024
64ba2e9
lock
fogelito Nov 13, 2024
4d99a51
Remove comments
fogelito Nov 13, 2024
88f5806
Merge pull request #481 from utopia-php/0.53.x-alter-attribute-indexes
abnegate Nov 14, 2024
f1c1410
create table bigint
fogelito Nov 14, 2024
a4498fd
Index Length share table
fogelito Nov 14, 2024
5e54e78
Postgres
fogelito Nov 14, 2024
a8d3f8d
Check index length for big int
fogelito Nov 14, 2024
c50eeb7
Fix create documents event
PineappleIOnic Nov 15, 2024
be5032a
Run Linter
PineappleIOnic Nov 15, 2024
99b2cb5
Don't throw when deleting indexes that don't exist
PineappleIOnic Nov 15, 2024
d705a02
Run Linter
PineappleIOnic Nov 15, 2024
145c845
Merge pull request #484 from utopia-php/fix-delete-index
abnegate Nov 18, 2024
1f7cbd4
Merge pull request #483 from utopia-php/0.53-fix-bulk-events
abnegate Nov 18, 2024
0f9fc73
Remove comment
fogelito Nov 18, 2024
1512ff3
Change Bulk Signatures to give out documents instead of count
PineappleIOnic Nov 20, 2024
97b510b
Make tests checked returned documents
PineappleIOnic Nov 20, 2024
fa67c0f
Address comments, fix tests
PineappleIOnic Nov 21, 2024
67b871b
Run Formatter
PineappleIOnic Nov 21, 2024
4590937
Address comments
PineappleIOnic Nov 21, 2024
b5bd17e
Merge pull request #485 from utopia-php/feat-change-bulk-signatures
abnegate Nov 21, 2024
5431c46
Update Create Documents to fire individual events
PineappleIOnic Nov 22, 2024
69e210d
Address PHP 8.4 Deprecations for PHPStan
PineappleIOnic Nov 22, 2024
19231e6
Merge pull request #486 from utopia-php/0.53.x-update-bulk-events
abnegate Nov 25, 2024
f29c159
Adapter create after limit checks
abnegate Nov 25, 2024
0e58017
Fix meta check
abnegate Nov 25, 2024
43180e3
Delete table if metadata create failed
abnegate Nov 25, 2024
bd50243
Dump on metadata create fail
abnegate Nov 26, 2024
38354fb
Remove dump
abnegate Nov 26, 2024
c3b8f81
Catch not found exception when checking database exists
abnegate Nov 26, 2024
d53d6ab
Fix stan
abnegate Nov 26, 2024
6fdc4cc
Debug dump
abnegate Nov 27, 2024
c3f0374
Remove logging
abnegate Nov 27, 2024
6f99137
DROP TABLE IF EXISTS
fogelito Dec 1, 2024
8a89f34
DROP TABLE IF EXISTS
fogelito Dec 1, 2024
4ddd1bd
Remove DROP TABLE IF EXISTS
fogelito Dec 1, 2024
8efa45c
lint
fogelito Dec 1, 2024
b9940b0
Remove comment
abnegate Dec 2, 2024
29f5e3f
Merge pull request #489 from utopia-php/0.53.x-rm-drop-table
abnegate Dec 2, 2024
12c42df
Merge pull request #487 from utopia-php/fix-create-order-of-operations
abnegate Dec 2, 2024
a13ea29
Merge remote-tracking branch 'origin/0.53.x' into fix-not-found-db
abnegate Dec 2, 2024
e7bfd89
Remove PDO specific exception from interface
abnegate Dec 2, 2024
d95bbbd
Merge pull request #488 from utopia-php/fix-not-found-db
abnegate Dec 2, 2024
66011b1
Move all events into individual ones
PineappleIOnic Dec 2, 2024
a351af6
Merge pull request #490 from utopia-php/0.53.x-bulk-batch-events
abnegate Dec 2, 2024
89dbbf8
Switch to counting documents for event
PineappleIOnic Dec 2, 2024
d3a8cae
Merge pull request #491 from utopia-php/0.53.x-bulk-batch-events
abnegate Dec 2, 2024
7eb005d
Schema attributes
fogelito Dec 5, 2024
aa4a0cf
comment
fogelito Dec 5, 2024
3f7fb81
lint
fogelito Dec 5, 2024
67dda79
add adapter
fogelito Dec 5, 2024
d07b0ad
fix phpstan
fogelito Dec 5, 2024
4d6fb4c
Respect timestamps in bulk operations and add tests
PineappleIOnic Dec 6, 2024
6d88050
Fix PHPStan
PineappleIOnic Dec 6, 2024
eea30ac
Address comments
fogelito Dec 8, 2024
8470c30
lint
fogelito Dec 8, 2024
c8086fd
analyze
fogelito Dec 8, 2024
3fb18da
Return array of Documents
fogelito Dec 8, 2024
9cdcb8a
Merge pull request #492 from utopia-php/schema-attributes
abnegate Dec 9, 2024
08e2b39
Address Comments
PineappleIOnic Dec 9, 2024
7421381
Merge pull request #493 from utopia-php/0.53.x-bulk-respect-timestamp
abnegate Dec 9, 2024
aa8f7cb
Dependency Exception
fogelito Dec 23, 2024
8282694
deleteAttribute functional index dependency
fogelito Dec 23, 2024
4a9cd83
getSupportForCastIndexArray
fogelito Dec 23, 2024
93355a9
formatting
fogelito Dec 23, 2024
894f1ec
Add length
fogelito Dec 23, 2024
db7d41d
Remove try catch
fogelito Dec 23, 2024
ca2cb86
Adapter first
fogelito Dec 23, 2024
dd5f264
lock
fogelito Dec 23, 2024
57793e0
Remove comment
fogelito Dec 23, 2024
1080915
Extra line
fogelito Dec 23, 2024
9ffece8
hints
fogelito Dec 23, 2024
8ea2a53
deleteIndex adapter before metadata
fogelito Dec 24, 2024
77756cb
datetime testing
fogelito Dec 26, 2024
466dded
Merge pull request #496 from utopia-php/0.53.x-create-collection-drop
christyjacob4 Jan 2, 2025
d6067ec
Merge pull request #497 from utopia-php/validate-date
abnegate Jan 8, 2025
4cb6368
Update tests/e2e/Adapter/Base.php
abnegate Jan 8, 2025
e1d5ab5
Merge branch '0.53.x' into 0.53.x-rename-json-index
abnegate Jan 8, 2025
4587c19
Merge pull request #495 from utopia-php/0.53.x-rename-json-index
abnegate Jan 8, 2025
eb9cb6e
Merge pull request #482 from utopia-php/primary-key-bigint
abnegate Jan 8, 2025
07b46fd
Override messages for processed exceptions
abnegate Jan 10, 2025
c0b5745
Fix tests
abnegate Jan 10, 2025
fc2ab1b
Fix test
abnegate Jan 10, 2025
623108c
Fix test
abnegate Jan 10, 2025
2f82c7a
Merge pull request #499 from utopia-php/fix-exception-messages
abnegate Jan 10, 2025
0e6b2e7
Fix indexed query validation not checking nested queries
abnegate Jan 10, 2025
874f2fa
Merge pull request #500 from utopia-php/fix-nested-validation
abnegate Jan 10, 2025
67e237c
Revert "Primary key bigint"
abnegate Jan 10, 2025
6491885
FIx tests
abnegate Jan 10, 2025
981a124
Merge pull request #501 from utopia-php/revert-482-primary-key-bigint
abnegate Jan 10, 2025
af2d2f4
Revert "Merge pull request #376 from utopia-php/feat-framework-v2"
abnegate Jan 13, 2025
169977b
Fix test refs
abnegate Jan 13, 2025
0cbdb24
Update cache
abnegate Jan 13, 2025
1c0edeb
Update framework
abnegate Jan 13, 2025
15c0b00
Update test auth refs
abnegate Jan 13, 2025
7c4237e
Format
abnegate Jan 13, 2025
2626a74
Sync database
abnegate Jan 13, 2025
1f4b7df
Merge remote-tracking branch 'origin/0.53.x' into chore-revert-framew…
abnegate Jan 13, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ jobs:
Postgres,
SQLite,
MongoDB,
Mirror,
SharedTables/MariaDB,
SharedTables/MySQL,
SharedTables/Postgres,
Expand Down
41 changes: 26 additions & 15 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,28 +1,39 @@
FROM composer:2.0 AS composer

ARG TESTING=false
ENV TESTING=$TESTING

WORKDIR /usr/local/src/

COPY composer.lock /usr/local/src/
COPY composer.json /usr/local/src/

RUN composer install --ignore-platform-reqs --optimize-autoloader \
--no-plugins --no-scripts --prefer-dist

FROM php:8.3.3-cli-alpine3.19 AS compile
RUN composer install \
--ignore-platform-reqs \
--optimize-autoloader \
--no-plugins \
--no-scripts \
--prefer-dist

FROM php:8.3.10-cli-alpine3.20 AS compile

ENV PHP_REDIS_VERSION=6.0.2 \
PHP_SWOOLE_VERSION=v5.1.2 \
PHP_MONGO_VERSION=1.16.1 \
PHP_XDEBUG_VERSION=3.3.2
ENV PHP_REDIS_VERSION="6.0.2" \
PHP_SWOOLE_VERSION="v5.1.3" \
PHP_MONGO_VERSION="1.16.1" \
PHP_XDEBUG_VERSION="3.3.2"

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN \
apk update \
&& apk add --no-cache postgresql-libs postgresql-dev make automake autoconf gcc g++ git brotli-dev linux-headers \
&& apk add --no-cache \
postgresql-libs \
postgresql-dev \
make \
automake \
autoconf \
gcc \
g++ \
git \
brotli-dev \
linux-headers \
&& docker-php-ext-install opcache pgsql pdo_mysql pdo_pgsql \
&& apk del postgresql-dev \
&& rm -rf /var/cache/apk/*
Expand Down Expand Up @@ -86,6 +97,7 @@ RUN echo extension=redis.so >> /usr/local/etc/php/conf.d/redis.ini
RUN echo extension=swoole.so >> /usr/local/etc/php/conf.d/swoole.ini
RUN echo extension=mongodb.so >> /usr/local/etc/php/conf.d/mongodb.ini
RUN echo extension=pcov.so >> /usr/local/etc/php/conf.d/pcov.ini
RUN echo extension=xdebug.so >> /usr/local/etc/php/conf.d/xdebug.ini

RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"

Expand All @@ -100,14 +112,13 @@ COPY --from=mongodb /usr/local/lib/php/extensions/no-debug-non-zts-20230831/mong
COPY --from=pcov /usr/local/lib/php/extensions/no-debug-non-zts-20230831/pcov.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/
COPY --from=xdebug /usr/local/lib/php/extensions/no-debug-non-zts-20230831/xdebug.so /usr/local/lib/php/extensions/no-debug-non-zts-20230831/

# Add Source Code
COPY ./bin /usr/src/code/bin
COPY ./src /usr/src/code/src
COPY ./dev /usr/src/code/dev

# Add Debug Configs
RUN if [ "$DEBUG" == "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi
RUN if [ "$DEBUG" == "true" ]; then mkdir -p /tmp/xdebug; fi
RUN if [ "$DEBUG" = "true" ]; then cp /usr/src/code/dev/xdebug.ini /usr/local/etc/php/conf.d/xdebug.ini; fi
RUN if [ "$DEBUG" = "true" ]; then mkdir -p /tmp/xdebug; fi
RUN if [ "$DEBUG" = "false" ]; then rm -rf /usr/src/code/dev; fi
RUN if [ "$DEBUG" = "false" ]; then rm -f /usr/local/lib/php/extensions/no-debug-non-zts-20220829/xdebug.so; fi

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ A list of the utopia/php concepts and their relevant equivalent using the differ
- **Document** - A simple JSON object that will be stored in one of the utopia/database collections. For SQL-based adapters, this will be equivalent to a row. For a No-SQL adapter, this will equivalent to a native document.
- **Attribute** - A simple document attribute. For SQL-based adapters, this will be equivalent to a column. For a No-SQL adapter, this will equivalent to a native document field.
- **Index** - A simple collection index used to improve the performance of your database queries.
- **Permissions** - Using permissions, you can decide which roles have read, create, update and delete access for a specific document. The special attribute `$permissions` is used to store permission metadata for each document in the collection. A permission role can be any string you want. You can use `$authorization->addRole()` to delegate new roles to your users, once obtained a new role a user would gain read, create, update or delete access to a relevant document.
- **Permissions** - Using permissions, you can decide which roles have read, create, update and delete access for a specific document. The special attribute `$permissions` is used to store permission metadata for each document in the collection. A permission role can be any string you want. You can use `Authorization::setRole()` to delegate new roles to your users, once obtained a new role a user would gain read, create, update or delete access to a relevant document.

### Filters

Expand Down
2 changes: 1 addition & 1 deletion bin/tasks/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
use Utopia\Database\Adapter\Mongo;
use Utopia\Database\Adapter\MySQL;
use Utopia\Database\Database;
use Utopia\Http\Validator\Text;
use Utopia\Mongo\Client;
use Utopia\Validator\Text;

/**
* @Example
Expand Down
19 changes: 9 additions & 10 deletions bin/tasks/load.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
use Utopia\Database\Helpers\Permission;
use Utopia\Database\Helpers\Role;
use Utopia\Database\Validator\Authorization;
use Utopia\Http\Validator\Numeric;
use Utopia\Http\Validator\Text;
use Utopia\Mongo\Client;

$authorization = new Authorization();
use Utopia\Validator\Numeric;
use Utopia\Validator\Text;

/**
* @Example
Expand Down Expand Up @@ -63,7 +61,7 @@
$database->setNamespace($namespace);

// Outline collection schema
$createSchema($database);
createSchema($database);

// reclaim resources
$database = null;
Expand Down Expand Up @@ -123,7 +121,7 @@
$database->setNamespace($namespace);

// Outline collection schema
$createSchema($database);
createSchema($database);

// reclaim resources
$database = null;
Expand Down Expand Up @@ -185,7 +183,7 @@
$database->setNamespace($namespace);

// Outline collection schema
$createSchema($database);
createSchema($database);

// Fill DB
$faker = Factory::create();
Expand Down Expand Up @@ -228,13 +226,14 @@
});


$createSchema = function (Database $database) use ($authorization): void {
function createSchema(Database $database): void
{
if ($database->exists($database->getDatabase())) {
$database->delete($database->getDatabase());
}
$database->create();

$authorization->addRole(Role::any()->toString());
Authorization::setRole(Role::any()->toString());

$database->createCollection('articles', permissions: [
Permission::create(Role::any()),
Expand All @@ -248,7 +247,7 @@
$database->createAttribute('articles', 'views', Database::VAR_INTEGER, 0, true);
$database->createAttribute('articles', 'tags', Database::VAR_STRING, 0, true, array: true);
$database->createIndex('articles', 'text', Database::INDEX_FULLTEXT, ['text']);
};
}

function createDocument($database, Generator $faker): void
{
Expand Down
24 changes: 13 additions & 11 deletions bin/tasks/query.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
use Utopia\Database\Adapter\MySQL;
use Utopia\Database\Database;
use Utopia\Database\Query;
use Utopia\Http\Validator\Numeric;
use Utopia\Http\Validator\Text;
use Utopia\Database\Validator\Authorization;
use Utopia\Mongo\Client;
use Utopia\Validator\Numeric;
use Utopia\Validator\Text;

/**
* @Example
Expand Down Expand Up @@ -83,35 +84,35 @@

$report = [];

$count = $setRoles($faker, 1);
$count = setRoles($faker, 1);
Console::info("\n{$count} roles:");
$report[] = [
'roles' => $count,
'results' => runQueries($database, $limit)
];

$count = $setRoles($faker, 100);
$count = setRoles($faker, 100);
Console::info("\n{$count} roles:");
$report[] = [
'roles' => $count,
'results' => runQueries($database, $limit)
];

$count = $setRoles($faker, 400);
$count = setRoles($faker, 400);
Console::info("\n{$count} roles:");
$report[] = [
'roles' => $count,
'results' => runQueries($database, $limit)
];

$count = $setRoles($faker, 500);
$count = setRoles($faker, 500);
Console::info("\n{$count} roles:");
$report[] = [
'roles' => $count,
'results' => runQueries($database, $limit)
];

$count = $setRoles($faker, 1000);
$count = setRoles($faker, 1000);
Console::info("\n{$count} roles:");
$report[] = [
'roles' => $count,
Expand All @@ -135,12 +136,13 @@
Console::error($error->getMessage());
});

$setRoles = function ($faker, $count) use ($authorization): int {
function setRoles($faker, $count): int
{
for ($i = 0; $i < $count; $i++) {
$authorization->addRole($faker->numerify('user####'));
Authorization::setRole($faker->numerify('user####'));
}
return \count($authorization->getRoles());
};
return \count(Authorization::getRoles());
}

function runQueries(Database $database, int $limit): array
{
Expand Down
26 changes: 16 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,33 +27,39 @@
"Composer\\Config::disableProcessTimeout",
"docker compose exec tests vendor/bin/phpunit --configuration phpunit.xml"
],
"lint": "./vendor/bin/pint --test",
"format": "./vendor/bin/pint",
"lint": "php -d memory_limit=2G ./vendor/bin/pint --test",
"format": "php -d memory_limit=2G ./vendor/bin/pint",
"check": "./vendor/bin/phpstan analyse --level 7 src tests --memory-limit 2G",
"coverage": "./vendor/bin/coverage-check ./tmp/clover.xml 90"
},
"require": {
"php": ">=8.3",
"ext-pdo": "*",
"ext-mbstring": "*",
"php": ">=8.0",
"utopia-php/framework": "1.0.*",
"utopia-php/cache": "0.10.*",
"utopia-php/framework": "0.33.*",
"utopia-php/cache": "0.11.*",
"utopia-php/mongo": "0.3.*"
},
"require-dev": {
"fakerphp/faker": "1.23.*",
"phpunit/phpunit": "9.6.*",
"pcov/clobber": "2.0.*",
"phpunit/phpunit": "9.*",
"pcov/clobber": "2.*",
"swoole/ide-helper": "5.1.3",
"utopia-php/cli": "0.19.*",
"laravel/pint": "1.17.*",
"phpstan/phpstan": "1.11.*",
"utopia-php/cli": "0.14.*",
"laravel/pint": "1.*",
"phpstan/phpstan": "1.*",
"rregeer/phpunit-coverage-check": "0.3.*"
},
"suggests": {
"ext-mongodb": "Needed to support MongoDB Database Adapter",
"ext-redis": "Needed to support Redis Cache Adapter",
"ext-pdo": "Needed to support MariaDB, MySQL or SQLite Database Adapter",
"mongodb/mongodb": "Needed to support MongoDB Database Adapter"
},
"config": {
"allow-plugins": {
"php-http/discovery": true,
"tbachert/spi": true
}
}
}
Loading
Loading