1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 15:34:03 +00:00
Commit graph

1398 commits

Author SHA1 Message Date
eac88dcc2a contributing note about mssql on Apple Silicon 2025-02-19 12:38:35 +01:00
ffad2db103 fix regression in previous commit: consume PendingDispatch *before* reverting context 2025-02-19 12:28:38 +01:00
b9cc63feed handle exceptions in Tenancy:run() 2025-02-19 12:02:58 +01:00
7bc2bb6f6a Revert "Add laravel/framework:dev-master to CI matrix"
This reverts commit 29bfe532fa.
2025-02-14 14:35:34 +01:00
29bfe532fa
Add laravel/framework:dev-master to CI matrix 2025-02-14 14:20:41 +01:00
lukinovec
cecf07a8c9
[4.x] Add tenant parameter to defaults() in UrlGeneratorBootstrapper (#1311)
* Pass tenant parameter using defaults in UrlGeneratorBootstrapper, update tests accordingly (wip)

* Fix code style (php-cs-fixer)

* Update bootstrapper

* Improve TenancyUrlGenerator docblocks

* Improve bootstrapper/TenancyUrlGenerator tests (WIP)

* Improve route() name prefixing test

* Keep  `UrlGeneratorBootstrapper::$addTenantParameterToDefaults` disabled by default

* Add `$override` functionality  to TenancyUrlGenerator

* Test $override functionality, update new defaults in the bootstrapper tests

* Fix code style (php-cs-fixer)

* Update comments

* Update routeNameOverride()

* cleanup

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2025-02-14 13:57:29 +01:00
lukinovec
fffaf7c58c
Test ecnrypted casts (#1284) 2025-02-14 08:48:16 +01:00
30ee4e9529
[4.x] Fix 1267: early return in runForMultiple if an empty array is passed (#1286)
* fix 1267: early return in runForMultiple if an empty array is passed

* Test that runForMulltiple runs the passed closure for the right tenants

* Correct comment

---------

Co-authored-by: lukinovec <lukinovec@gmail.com>
2025-02-14 08:19:02 +01:00
25360f6b6a
[4.x] Improve id generators (#1300)
* add RandomIntGenerator

* remove string assertions

* make int ranges configurable

* update test to use min & max
2025-01-21 17:06:15 +01:00
7ce7629864 use mysql:8 in docker 2025-01-21 15:23:17 +01:00
8f2cb894ce phpstan fixes for spatie invader 2025-01-21 14:35:00 +01:00
c239239972 fix #1297 - require spatie/invade:* 2025-01-21 14:19:22 +01:00
lukinovec
8b131ed647
Allow overriding root URL in tests by default (#1296)
* Allow overriding root URL in tests by default

* Add todo@revisit
2025-01-17 10:20:40 +01:00
Samuel Štancl
5d3b3d3c21
[4.x] Improve RootUrl and UrlGenerator bootstrappers (#1294)
* Make RootUrlBootstrapper run ONLY in CLI by default (add $rootUrlOverrideInTests), work with resolved UrlGenerator

* Make resolving 'url' return a pre-created generator instance instead of creating it on every app('url') call

* Take care of doubling tenant keys in TenancyUrlGenerator, add regression test for using UrlGenerator and RootUrl bootstrappers together

* Fix code style (php-cs-fixer)

* refactor RootUrlBootstrapper

* add docblock

* clarify docblock

* simplify test: use concrete values instead of overly dynamic code

* Fix bootstrapper order in test, add url('/') assertion

* Use $this->app instead of app()

* Improve TenancyUrlGenerator and RootUrlBootstrapperTest clarity

* Revert attempt to maintain compatibility between the two bootstrappers

* Delete bootstrapper combining test

* Fix code style (php-cs-fixer)

---------

Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
2025-01-16 10:30:06 +01:00
Samuel Štancl
8f958d5779
[4.x] Queue logic refactor (#1289)
* simplify QueueTenancyBootstrapper

* wip: add persistent queue bootstrapper, minor testcase refactor

* ci: run persistent queue tests

* simplify persistent queue bootstrapper

* Fix code style (php-cs-fixer)

* phpstan fixes, clarify previousTenant use

* remove false positive regression test

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-01-14 13:49:16 +01:00
lukinovec
0e223e0484
[4.x] Fix tenants:run argument parsing (#1287)
* Use StringInput instead of ArgvInput so that tenants:run accepts args properly

* Test that tenants:run parses the arguments correctly

* Fix code style (php-cs-fixer)

* Fix PHPStan issue

* remove unnecessary ()

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2025-01-11 12:03:09 +01:00
f955b38e2b phpstan fixes 2025-01-05 15:50:30 +01:00
3c183e45d9 fix #1277: consume PendingDispatch return values in Tenancy::run() 2025-01-04 15:57:01 +01:00
99357d94df ci: make phpcsfixer job use GH bot account 2025-01-04 15:37:20 +01:00
Samuel Štancl
a88a42fbbf
[4.x] Add DisallowSqliteAttach feature (#1283)
* queue.yml: remove TENANCY_VERSION env var from test.sh

* add DisallowSqliteAttach feature

* Fix code style (php-cs-fixer)

* ci: add cd to each step

* ci: simpler solution to race conditions, proper os/arch matrix

* ci: fix runs-on matrix

* ci: fix workflow on windows, fix makefile

* Auto-build: Update extensions [skip ci]

* Auto-build: Update extensions [skip ci]

* ci: try fixing retry logic, make makefile use cl on Windows

* ci: use the current branch for rebase

* ci: try calling vcvars64

* ci: misc minor fixes

* ci: try fixing c compiler on windows

* ci: misc minor fixes

* ci: add debug steps

* ci: try to fix windows build

* ci: try using clang on windows

* ci: windows fixes, makefile fix

* Auto-build: Update extensions [skip ci]

* ci: dont produce .exp .lib on Windows

* ci: try forcing shell: bash on commit step

* ci: try to get linux cross-compilation working

* ci: reformulate condition

* ci: fix syntax error

* ci: correct debian image name

* Auto-build: Update extensions [skip ci]

* ci: try to set up macOS cross-compilation

* ci: add ARCH variable to makefile, override it during cross-compilation

* Auto-build: Update extensions [skip ci]

* ci: X64 -> x64

* ci: only trigger extensions.yml on pushes to extensions/

* fix tests on x64

* ci: try using bash for pushing on windows; ignore phpstan error

* fix test failing in ci but passing locally

* bump php version in composer.json, trigger extensions.yml build

* remove comment

* noattach: more explicit return values, avoid potential non-bool return values

* makefile: use -Os on Windows

* ci: use make -B

* ci: try triggering extensions build on extensions.yml file changes

* Auto-build: Update extensions [skip ci]

* Auto-build: Update extensions [skip ci]

* ci: remove windows linker flag, use a whitelist for git add

* Auto-build: Update extensions [skip ci]

* Auto-build: Update extensions [skip ci]

* Auto-build: Update extensions [skip ci]

* fix path in feature class, minor refactor

* Fix code style (php-cs-fixer)

---------

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2025-01-04 15:34:37 +01:00
Michael Kampmann Petræus
6b38a356cb
fix: drop tenant databases on migrate fresh without domains (#1282) 2025-01-01 20:31:47 +01:00
abe1f1f0ec queue ci: set TENANCY_VERSION for setup.sh 2024-12-31 07:40:06 +01:00
f84b22e6ce add queue CI workflow 2024-12-31 06:44:50 +01:00
Márk Magyar
79f740d057
[4.x] General code cleanup (#1278)
* Declare sensitive parameters as sensitive

... just so that they don't show up in logs

* Remove unnecessary null-coalescing

* Simplify return

* Merge isset() calls

* Inline return

* Use nullsafe operator

* Simplify if-else branches

* Use direct empty string comparison instead of strlen()

* Add missing type

* Change interface as events expect a TenantWithDatabase not just a Tenant

* Narrow typehint

* Remove redundant type casts

* Fix style with php-cs-fixer

* Fix typos

* Revert unwanted if-else simplification

* fix phpstan errors

* narrow type

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-12-31 00:35:46 +01:00
Alec
05b602e37f
fix: no primary key on RLS views (#1280)
* fix: no primary key on RLS views

* test: add RLS view regression

* verify and slightly refactor regression test

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-12-31 00:02:50 +01:00
eff41553d7 deprecate JobBatchBootstrapper 2024-12-27 21:33:44 +01:00
5777ff850f bump php version 2024-12-26 05:51:46 +01:00
855ba91508 prepare for public beta 2024-12-26 05:00:58 +01:00
79444723dd phpstan fix 2024-12-20 03:47:35 +01:00
lukinovec
cb0d7e2902
Improve early identification tests (#66)
* Separate route-level domain identification test from path/request to improve readability WIP

* Get rid of confusing datasets in route-level identifcation tests

* Clean up updated tests

* Simplify early id tests

* Reduce dataset duplication

* Improve test readability, fix false positive,  polish details

* Separate early ID test from defaulting test (WIP)

* Finish improving and correcting the early identification/default route mode tests

* Make flag/default mode usage more clear by improving the docblock in DealsWithRouteContexts

* Fix PHPUnit deprecation warnings

* code review

* code review

---------

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2024-12-20 03:42:23 +01:00
Samuel Štancl
48b916e182
Supported named in-memory SQLite databases (#69)
This PR adds support for named in-memory SQLite databases, making it feasible to use in-memory SQLite for tenant databases in tests.

The usage is simply creating a tenant with 'tenancy_db_name' => ':memory:' and the bootstrapper will automatically update the tenant with a database name derived from its tenant key.

There are static property hooks for keeping these DBs alive (at least one connection needs to be open, they don't have process lifetime and are essentially "refcounted") and closing them when the database is deleted. This gives the user control over the lifetimes of these databases.
2024-11-25 04:48:52 +01:00
Samuel Štancl
85bdbd57f7
Fix pullFromPendingPool() behavior (#70) 2024-11-25 04:44:39 +01:00
PHP CS Fixer
19631f4e9a Fix code style (php-cs-fixer) 2024-11-09 19:54:56 +00:00
56dd4117ab Fix origin id w/ empty header & using full-hostname subdomain records
This makes it possible to have Domain records in both `foo` and
`foo.{centralDomain}` format when using the combined domain/subdomain
identification middleware, or the origin header id mw which extends it.

This commit also refactors some related logic.
2024-11-09 20:48:45 +01:00
c199a6e0c8 Merge branch 'master' of github.com:tenancy-for-laravel/v4 2024-10-11 23:01:25 +02:00
10b214c452 add phpstan ignore 2024-10-11 23:01:12 +02:00
lukinovec
5f8a3d2ffe
Improve the tests where the removed universal_channel() was still used (#64) 2024-10-11 22:50:38 +02:00
a07ba8c76c docker: add composer back 2024-10-11 21:54:10 +02:00
PHP CS Fixer
d4b9972600 Fix code style (php-cs-fixer) 2024-10-11 19:32:21 +00:00
9ee1d63dce sqlite: use WAL journal mode by default 2024-10-11 21:31:54 +02:00
43d821ca49 docker: base Dockerfile on php images, misc improvements 2024-10-11 21:29:54 +02:00
a52efe5cf0 wip broadcasting test fixes 2024-10-03 21:34:05 +02:00
a37dc9b449 reimplement broadcasting channel helpers to support model binding 2024-10-03 21:12:09 +02:00
836a258a78 sqlite: use .sqlite suffix if db.suffix is empty 2024-09-30 16:49:46 +02:00
c6ba62bdd0 ParallelCommand: add -P option for bypassing MAX_PROCESSES 2024-09-30 16:36:37 +02:00
303b52d25a minor improvements to parallelization logic 2024-09-29 12:42:29 +02:00
075789eb91 fix typo in ParallelCommand 2024-09-29 12:25:46 +02:00
f017b6509b fix sysctl string 2024-09-27 23:21:08 +02:00
b01c16f4fc phpstan fixes 2024-09-27 23:16:39 +02:00
39bcbda5d0 parallel commands: core # autodetect, bugfixes, improved output 2024-09-27 23:02:03 +02:00