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

332 commits

Author SHA1 Message Date
Abrar Ahmad
409190fae1
[4.x] Improve tenants:run command to execute Input\Output commands (#923)
* run command useable for questions asking commands

* move console classes to Console directory

* fix styling

* Update src/Commands/Run.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* remove tenant migration line

* assert command executed in tenant context

* improve test

* cleanup code

* Update CommandsTest.php

* remove irrelevant assertions

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-09-02 18:46:13 +02:00
lukinovec
3bf2c39e1a
[4.x] Make impersonation tokens require stateful guards (#935)
* Throw an exception on attempt to create impersonation token with a non-stateful guard

* Test that impersonation tokens can only be created with a stateful guard

* Fix code style (php-cs-fixer)

* Escape backslashes in the exception's message

Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>

* Make the exception only about requiring a stateful guard

Co-authored-by: PHP CS Fixer <phpcsfixer@example.com>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-09-02 17:46:27 +02:00
Samuel Štancl
f941df3a82 minor improvements for phpstan 2022-09-01 19:06:54 +02:00
Samuel Štancl
8af354c20e get phpstan errors down from 252 to 189 2022-08-30 05:44:23 +02:00
Samuel Štancl
40bf28c7d0 general refactor, move more classes under Database namespace 2022-08-27 03:17:16 +02:00
Samuel Štancl
55d0a9ab87 misc improvements - stronger types, exception refactor 2022-08-26 21:35:17 +02:00
Samuel Štancl
931c76d697
Pull 3.x changes into master (#922)
* exclude master from CI

* Add space after 'up' in 'docker-compose up-d' (#900)

* Fix ArgumentCountError on the TenantAssetsController (#894)

* Fix ArgumentCount exception on the TenantAssetsController when no `$path` is provided

* CS

* CS

* Handle null case explicitly

* code style

Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: Samuel Štancl <samuel@archte.ch>

* Add support for nested tenant config override (#920)

* feat: add support for nested tenant config override

* test: ensure nested tenant values are mapped

* Update TenantConfigTest.php

Co-authored-by: lukinovec <lukinovec@gmail.com>
Co-authored-by: Bram Wubs <megawubs@users.noreply.github.com>
Co-authored-by: Bram Wubs <bram@sibi.nl>
Co-authored-by: George Bishop <email.georgebishop@gmail.com>
Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
2022-08-22 17:59:43 +02:00
Abrar Ahmad
a45aa8e274
Improve tenants:run command (#912)
* improve `tenants:run` command

* Update Run.php
2022-08-04 20:29:39 +02:00
Samuel Štancl
d0baabbc9d Merge branch 'master' of github.com:archtechx/tenancy 2022-07-28 15:30:19 +02:00
Samuel Štancl
be13160133 wip Debuggable trait 2022-07-28 15:14:29 +02:00
Abrar Ahmad
29634dda84
added $this->mockConsoleOutput (#907) 2022-07-27 01:35:55 +02:00
beezerk23
233a1222bf
feat(UniversalRoutes): Stop overwriting the (maybe) customized onFail… (#679)
* feat(UniversalRoutes): Stop overwriting the (maybe) customized onFail method and just call it in case of an exception

* throw correct exception when `$originalOnFail()` is null

* Update DomainTest.php

* convert test to pest and renamed

* Update tests/DomainTest.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-07-25 18:37:52 +02:00
Samuel Štancl
f9c9d8615f Refactor tests to use pest() helper 2022-07-23 01:16:50 +02:00
Samuel Štancl
b47c5549ef
[4.x] Migrate tests to Pest (#884)
* Add Pest dependencies

* Add base Pest file

* Convert test cases

* Remove non-compound imports

* Adopt expectation API

* Optimize uses

* Shift cleanup

* phpunit -> pest

* Fix tests in PR #884 PHPUnit to Pest Converter  (#885)

* fixed tests, remove method duplications, restore necessary inner classes

* Update CommandsTest.php

* temporary checks run on `shift-64622` on branch.

* fixed `TestSeeder` class not resolved

* fixed messed up names

* removed `uses` from individual files and add it in `Pest`

* extract tests to helpers

* use pest dataset

* Update AutomaticModeTest.php

* newline

* todo convention

* resolve reviews

* added `// todo@tests`

* remove shift branch from CI workflow

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* check if I have write permission

* Convert newly added tests to Pest

Co-authored-by: Shift <shift@laravelshift.com>
Co-authored-by: Abrar Ahmad <abrar.dev99@gmail.com>
2022-07-22 19:26:59 +02:00
Abrar Ahmad
97ab483173
Completing PR #881 (#902)
* install PHP CS Fixer

* Fix styling

* remove StyleCI config

* use config from archtechx/template

* Fix styling

* added `php-cs-fixer`

* Update .php-cs-fixer.php

* added GitHub token

* Update ci.yml

* Update ci.yml

* Update ci.yml

* php-cs-fixer workflow same as template

Co-authored-by: Erik Gaal <me@erikgaal.nl>
Co-authored-by: erikgaal <erikgaal@users.noreply.github.com>
2022-07-20 15:28:45 +02:00
Abrar Ahmad
627233d07a
[4.x] Don't use onDeleteCascade in the migrations (#883)
* removed `cascade` on delete for domains

* removed only `onDelete` cascade

* keep impersonation migrations unchanged

* domains set null on delete

* Update 2019_09_15_000020_create_domains_table.php

* Added DeleteDomain Job while deleting tenant.

* Update assets/TenancyServiceProvider.stub.php

Co-authored-by: Samuel Štancl <samuel@archte.ch>

* renamed class

* Update DeleteDomains.php

* onDelete restrict

* revert nullable

* removed `shouldQueue` interface

* Update TenancyServiceProvider.stub.php

* fetch and delete domains individually

* Update DeleteDomains.php

* tests for `DeleteDomains` job

Co-authored-by: Samuel Štancl <samuel@archte.ch>
2022-07-20 13:02:33 +02:00
Nick Kitchen
cc6d4fe0dd
[4.x] Added support for Microsoft Sql Server (#715)
* added support for microsoft sql server database

* added support for microsoft sql server database

* trigger ci

* revert change

* trigger ci

* Try installing pdo_sqlsrv

* different approach for installing sqlsrv via pecl

* add dependencies

* add gnupg2

* Update Dockerfile

* try skipping msodbcsql17

* Update Dockerfile

* add dependency back

* update before installing

* try to add mssql

* mssql host

* TENANCY_TEST_MSSQL_HOST env var

* add env vars for mssql

* add sqlsrv vars to TestCase

* rename vars to SQLSRV [skip ci]

* MSSQL -> SQLSRV

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-06-23 13:04:53 +02:00
Victor R
7d98ebb5d1
[4.x] Add tenant schema dump command (#807)
* Add tenant dump command

* Register tenant schema dump command

* Added tests for tenant schema dump command

* remove docblocks, fix tenant() logic

* trigger ci

* Install mysql-client

* mysql-client -> mariadb-client

* add tenant-schema-test.dump to .gitignore

Co-authored-by: Samuel Štancl <samuel@archte.ch>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-06-01 16:12:59 +02:00
Samuel Štancl
eca7b336bc merge 3.x 2022-06-01 14:58:44 +02:00
Nathan Dunn
40bf576e00
[3.x] Update PostgreSQLSchemaManager to set correct config key value (#840)
* Update PostgreSQLSchemaManager to set correct config key value

* Update to use version_compare

* Update TenantDatabaseManagerTest

* Improve TenantDatabaseManagerTest

* Update TenantDatabaseManager
2022-04-08 03:13:29 +02:00
Samuel Štancl
349125c02e
Merge hotfix branch (#834)
* try specifying the signature in __construct

* constructor doesn't work since Reflection is used, try specifying getDefaultName() instead

* Fixed: make migration commands compatible

* Fix failing tests

* Fix username generation

* Re-create tmp dir as well if needed

* wip
2022-03-30 18:00:55 +02:00
Samuel Štancl
e1ae6f4380 re-add queuetest.json 2022-03-23 20:57:15 +01:00
Samuel Štancl
5026f54a6d fix path prefixing 2022-03-23 20:48:55 +01:00
Erik Gaal
79e3d53b06
[3.x] Compatibility with Laravel 9 (#802)
* Test on Laravel 9

* Don't extend final Kernel class

* Make FilesystemTenancyBootstrapper compatible with Flysystem v3

Co-authored-by: George <jiri.zizka@funfirst.cz>

* Update tenant maintenance mode te be in line with Laravel

* Exclude PHP 7.4 <> L9 combination from testing

* add root_override-related assertions

* getPrefix -> getPathPrefix

* handle / inconsistency in s3 prefix

* Refactor Storage facade changes

Co-authored-by: George <jiri.zizka@funfirst.cz>
Co-authored-by: Samuel Štancl <samuel.stancl@gmail.com>
2022-03-08 01:50:25 +01:00
Samuel Štancl
8e9485f9b1 add empty queuetest.json 2022-02-19 16:31:31 +01:00
Samuel Štancl
27f916c323 end tenancy in queue if the next job is not tenant aware 2022-02-19 16:12:38 +01:00
Erik Gaal
9c79267e24
Fix .env loading in development (#799)
* Upgrade vlucas/phpdotenv to ^5.0

`Dotenv::create($paths)` was the syntax for releases before v4

* Remove vlucas/phpdotenv dependency and make it work with newer versions.
2022-02-14 14:31:01 +01:00
Samuel Štancl
a83568ded2 Only use JobRetryRequested in Laravel 8 2021-12-31 18:28:37 +01:00
Samuel Štancl
49ef28da05 6.x support 2021-12-31 18:19:53 +01:00
Samuel Štancl
73a4a3018c Improve queue tenancy 2021-12-31 18:10:03 +01:00
Samuel Štancl
9883219544 wip 2021-12-13 13:09:16 +01:00
Samuel Štancl
126afcd0dd
Terminating pipelines (#527)
* Return false from CreateDatabase job

* Terminating pipeline tests
2020-11-15 16:26:26 +01:00
Samuel Štancl
8f34a733d8
Add tenancy()->central() helper (#526)
* Add tenancy()->central() helper

* Apply fixes from StyleCI

* Add docblock

* Fix return typehint

Co-authored-by: stancl <stancl@users.noreply.github.com>
2020-11-13 08:15:24 +01:00
Dylan Harbour
e0af2e9945
Fix issue 521: Array input for --tenants (#522)
* Fix issue 521: Array input for `--tenants`

Tenancy for Laravel docs refer to using multiple `--tenants=<...> ` options when running a command for multiple tenants explicitly: https://tenancyforlaravel.com/docs/v3/console-commands

However, the command input is not defined correctly to receive arrays.
https://laravel.com/docs/7.x/artisan#input-arrays

This PR adds a failing test, fixes the issue and corrects a typo in the contributing readme.

* Styleci

Co-authored-by: Dylan Harbour <dylanh@ringier.co.za>
2020-11-12 14:08:37 +01:00
Samuel Štancl
d20056b804 Fix subdomain middleware 2020-08-01 15:07:10 +02:00
stancl
dbc77a110e Apply fixes from StyleCI 2020-07-06 12:45:10 +00:00
Samuel Štancl
f483d0b8cf Extract VirtualColumn package 2020-07-06 14:44:49 +02:00
Samuel Štancl
405a137ca1 Better solution for tenant DB exception 2020-06-29 12:18:03 +02:00
Samuel Štancl
41aead5da2 Revert "Get rid of TenantDatabaseDoesNotExist exception"
This reverts commit fe52a3c4ea.
2020-06-29 12:14:58 +02:00
Samuel Štancl
0c575f2463 Merge branch '3.x' of github.com:stancl/tenancy into 3.x 2020-06-29 09:59:23 +02:00
Samuel Štancl
fe52a3c4ea Get rid of TenantDatabaseDoesNotExist exception 2020-06-29 09:58:37 +02:00
stancl
c8ed904d16 Apply fixes from StyleCI 2020-06-28 16:25:43 +00:00
Samuel Štancl
8bf673098b Fix guzzle issue 2020-06-28 18:24:41 +02:00
Samuel Štancl
02e049b59e Convert domains to lowercase, persist current domain model on resolver 2020-06-28 11:45:08 +02:00
Samuel Štancl
e93e766f92 Remove unnecessary typehints 2020-06-08 21:35:41 +02:00
Samuel Štancl
6735d0a589 Switch to using MySQL for tests, resolve FK constraint issues 2020-06-07 10:28:55 +02:00
stancl
e1c79bab11 Apply fixes from StyleCI 2020-06-02 18:26:37 +00:00
Samuel Štancl
ba7257670f Add check to invalidateCache() 2020-06-02 20:26:17 +02:00
Samuel Štancl
da23662d7b Clenup for resource syncing 2020-06-01 09:51:22 +02:00
Samuel Štancl
6dad6ce49a Allow array values for Tenant Config
Closes #412
2020-05-30 17:14:56 +02:00