From 0433efe833104588a5a83973261d3059c7ef26eb Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 12 May 2023 16:07:43 +0300 Subject: [PATCH 01/10] feat: add shared labels workflow --- .github/workflows/label.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 1c654a3..495ccfb 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -12,11 +12,9 @@ name: 🏷️ Add labels jobs: label: - runs-on: ubuntu-latest - steps: - - name: 🏷️ Apply labels - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" + uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master + with: + os: ubuntu-latest + token: ${{ secrets.GITHUB_TOKEN }} ... From d9a676e4a9a93ccd236af214f36abea05f483c7f Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 12 May 2023 16:25:17 +0300 Subject: [PATCH 02/10] chore: bump workflows From 20e6c1984ba303c1b1ee7bf0e2c8a92f35f47b4b Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 12 May 2023 16:47:41 +0300 Subject: [PATCH 03/10] chore: bump workflows From 0a19aaccb467e4a5eb054571d54557560d4841c1 Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 12 May 2023 16:57:48 +0300 Subject: [PATCH 04/10] fix: secrets error in workflow --- .github/workflows/create-release.yml | 1 + .github/workflows/label.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 6926fbc..455aa63 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -17,6 +17,7 @@ jobs: os: ubuntu-latest branch: master package-name: laravel-cycle-starter-tpl + secrets: token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} ... diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml index 495ccfb..428ed4e 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/label.yml @@ -15,6 +15,7 @@ jobs: uses: wayofdev/gh-actions/.github/workflows/apply-labels.yml@master with: os: ubuntu-latest + secrets: token: ${{ secrets.GITHUB_TOKEN }} ... From d342e8888fb3c33f7ce9b65c5672b877fe59c560 Mon Sep 17 00:00:00 2001 From: lotyp Date: Fri, 12 May 2023 17:23:02 +0300 Subject: [PATCH 05/10] chore: bump workflows From 9b65cdaed31c7f90ca00b7fb3d2cd464308739ff Mon Sep 17 00:00:00 2001 From: lotyp Date: Mon, 15 May 2023 11:49:12 +0300 Subject: [PATCH 06/10] feat: moving to shared workflows --- .../workflows/{label.yml => apply-labels.yml} | 4 +++- .github/workflows/auto-merge-release.yaml | 19 +++++++++---------- ...ch-diagram.yml => create-arch-diagram.yml} | 18 ++++++++++-------- .github/workflows/shellcheck.yml | 18 ++++++------------ 4 files changed, 28 insertions(+), 31 deletions(-) rename .github/workflows/{label.yml => apply-labels.yml} (89%) rename .github/workflows/{codesee-arch-diagram.yml => create-arch-diagram.yml} (51%) diff --git a/.github/workflows/label.yml b/.github/workflows/apply-labels.yml similarity index 89% rename from .github/workflows/label.yml rename to .github/workflows/apply-labels.yml index 428ed4e..c9b1196 100644 --- a/.github/workflows/label.yml +++ b/.github/workflows/apply-labels.yml @@ -1,8 +1,10 @@ +--- + # This workflow will triage pull requests and apply a label based on the # paths that are modified in the pull request. # # To use this workflow, you will need to set up a .github/labeler.yml -# file with configuration. For more information, see: +# file with configuration. For more information, see: # https://github.com/actions/labeler/blob/master/README.md on: # yamllint disable-line rule:truthy diff --git a/.github/workflows/auto-merge-release.yaml b/.github/workflows/auto-merge-release.yaml index 9f4d53e..084a3e1 100644 --- a/.github/workflows/auto-merge-release.yaml +++ b/.github/workflows/auto-merge-release.yaml @@ -13,15 +13,14 @@ name: 🤞 Auto merge release jobs: auto-merge: - if: github.actor == 'lotyp' && startsWith(github.head_ref, 'release-please--') - runs-on: ubuntu-latest - steps: - - name: 🤞 Auto-merge pull request - uses: peter-evans/enable-pull-request-automerge@v3 - with: - pull-request-number: ${{ github.event.pull_request.number }} - merge-method: merge - # to trigger other workflows, pass PAT token instead of GITHUB_TOKEN - token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} + uses: wayofdev/gh-actions/.github/workflows/auto-merge-release.yml@master + with: + os: ubuntu-latest + pull-request-number: ${{ github.event.pull_request.number }} + actor: lotyp + merge-method: merge + secrets: + # to trigger other workflows, pass PAT token instead of GITHUB_TOKEN + token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} ... diff --git a/.github/workflows/codesee-arch-diagram.yml b/.github/workflows/create-arch-diagram.yml similarity index 51% rename from .github/workflows/codesee-arch-diagram.yml rename to .github/workflows/create-arch-diagram.yml index d066e3f..abb38a9 100644 --- a/.github/workflows/codesee-arch-diagram.yml +++ b/.github/workflows/create-arch-diagram.yml @@ -1,8 +1,9 @@ --- + # This workflow was added by CodeSee. Learn more at https://codesee.io/ # This is v2.0 of this workflow file -on: # yamllint disable-line rule:truthy +on: # yamllint disable-line rule:truthy push: branches: - develop @@ -18,10 +19,11 @@ permissions: read-all jobs: codesee: - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: 💻 Analyze the repo with CodeSee - uses: Codesee-io/codesee-action@v2 - with: - codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} + uses: wayofdev/gh-actions/.github/workflows/create-arch-diagram.yml@master + with: + os: ubuntu-latest + continue-on-error: true + secrets: + codesee-token: ${{ secrets.CODESEE_ARCH_DIAG_API_TOKEN }} + +... diff --git a/.github/workflows/shellcheck.yml b/.github/workflows/shellcheck.yml index bcfa96d..d23d164 100644 --- a/.github/workflows/shellcheck.yml +++ b/.github/workflows/shellcheck.yml @@ -10,17 +10,11 @@ permissions: jobs: shellcheck: - runs-on: ubuntu-latest - steps: - - name: 📦 Check out the codebase - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: 🐞 Differential shell-check - uses: redhat-plumbers-in-action/differential-shellcheck@v4 - with: - severity: warning - token: ${{ secrets.GITHUB_TOKEN }} + uses: wayofdev/gh-actions/.github/workflows/shellcheck.yml@master + with: + os: ubuntu-latest + severity: warning + secrets: + token: ${{ secrets.GITHUB_TOKEN }} ... From 790e9a5b4dd18de8dc268fa87781537532b24ff3 Mon Sep 17 00:00:00 2001 From: lotyp Date: Wed, 17 May 2023 19:57:34 +0300 Subject: [PATCH 07/10] feat: add example of cycle-orm usage --- Makefile | 2 +- app/composer.lock | 203 +++++++-------- app/config/cycle.php | 238 ++++++++++++++++++ ..._0_0_default_create_roles_create_users.php | 42 ++++ app/src/Domain/Role/Role.php | 23 ++ app/src/Domain/Role/RoleRepository.php | 12 + app/src/Domain/User/Models/User.php | 46 ---- app/src/Domain/User/User.php | 46 ++++ app/src/Domain/User/UserRepository.php | 12 + docker-compose.yaml | 4 +- 10 files changed, 480 insertions(+), 148 deletions(-) create mode 100644 app/config/cycle.php create mode 100644 app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php create mode 100644 app/src/Domain/Role/Role.php create mode 100644 app/src/Domain/Role/RoleRepository.php delete mode 100644 app/src/Domain/User/Models/User.php create mode 100644 app/src/Domain/User/UserRepository.php diff --git a/Makefile b/Makefile index 15de280..0361c3f 100644 --- a/Makefile +++ b/Makefile @@ -124,7 +124,7 @@ prepare: # ------------------------------------------------------------------------------------ up: # Creates and starts containers, defined in docker-compose and override file $(DOCKER_COMPOSE) up --remove-orphans -d - $(DOCKER_COMPOSE) exec app wait4x tcp database:5432 -t 1m + $(DOCKER_COMPOSE) exec app wait4x postgresql 'postgres://${DB_USERNAME}:${DB_PASSWORD}@database:5432/${DB_DATABASE}?sslmode=disable' -t 1m .PHONY: up down: # Stops and removes containers of this project diff --git a/app/composer.lock b/app/composer.lock index e30af0e..c639b9a 100644 --- a/app/composer.lock +++ b/app/composer.lock @@ -129,30 +129,30 @@ }, { "name": "cycle/annotated", - "version": "v3.2.1", + "version": "v3.3.0", "source": { "type": "git", "url": "https://github.com/cycle/annotated.git", - "reference": "0e0afb452fdedb0817d28201a1cd493f7ec8b3eb" + "reference": "d4d4c944f81e809688e77e5564acc198c8f11544" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/annotated/zipball/0e0afb452fdedb0817d28201a1cd493f7ec8b3eb", - "reference": "0e0afb452fdedb0817d28201a1cd493f7ec8b3eb", + "url": "https://api.github.com/repos/cycle/annotated/zipball/d4d4c944f81e809688e77e5564acc198c8f11544", + "reference": "d4d4c944f81e809688e77e5564acc198c8f11544", "shasum": "" }, "require": { "cycle/orm": "^2.2.0", - "cycle/schema-builder": "^2.3", - "doctrine/annotations": "^1.13 || ^2.0", + "cycle/schema-builder": "^2.4", + "doctrine/annotations": "^1.14.3 || ^2.0.1", "doctrine/inflector": "^2.0", "php": ">=8.0", "spiral/attributes": "^2.8|^3.0", "spiral/tokenizer": "^2.8|^3.0" }, "require-dev": { - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^4.18" + "phpunit/phpunit": "^9.6", + "vimeo/psalm": "^4.30" }, "type": "library", "autoload": { @@ -167,22 +167,22 @@ "description": "Cycle ORM Annotated Entities generator", "support": { "issues": "https://github.com/cycle/annotated/issues", - "source": "https://github.com/cycle/annotated/tree/v3.2.1" + "source": "https://github.com/cycle/annotated/tree/v3.3.0" }, - "time": "2023-02-01T17:01:38+00:00" + "time": "2023-05-16T07:50:25+00:00" }, { "name": "cycle/database", - "version": "2.4.1", + "version": "2.5.0", "source": { "type": "git", "url": "https://github.com/cycle/database.git", - "reference": "6ef38a473495128ba6bba211e4da8cbe4220776d" + "reference": "3d5cb741da405361260cf72d826a833d2cd85559" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/database/zipball/6ef38a473495128ba6bba211e4da8cbe4220776d", - "reference": "6ef38a473495128ba6bba211e4da8cbe4220776d", + "url": "https://api.github.com/repos/cycle/database/zipball/3d5cb741da405361260cf72d826a833d2cd85559", + "reference": "3d5cb741da405361260cf72d826a833d2cd85559", "shasum": "" }, "require": { @@ -203,6 +203,11 @@ "vimeo/psalm": "^4.23" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.5.x-dev" + } + }, "autoload": { "files": [ "src/polyfill.php", @@ -219,7 +224,7 @@ "description": "DBAL, schema introspection, migration and pagination", "support": { "issues": "https://github.com/cycle/database/issues", - "source": "https://github.com/cycle/database/tree/2.4.1" + "source": "https://github.com/cycle/database/tree/2.5.0" }, "funding": [ { @@ -227,24 +232,24 @@ "type": "github" } ], - "time": "2023-03-07T20:16:21+00:00" + "time": "2023-05-12T14:04:10+00:00" }, { "name": "cycle/migrations", - "version": "v4.0.1", + "version": "v4.1.0", "source": { "type": "git", "url": "https://github.com/cycle/migrations.git", - "reference": "943f42c7a0cbb311b0a3c027d5e944c74d0ac7de" + "reference": "177b1912220515c5a6dae7057bc0ad6ae826134f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/migrations/zipball/943f42c7a0cbb311b0a3c027d5e944c74d0ac7de", - "reference": "943f42c7a0cbb311b0a3c027d5e944c74d0ac7de", + "url": "https://api.github.com/repos/cycle/migrations/zipball/177b1912220515c5a6dae7057bc0ad6ae826134f", + "reference": "177b1912220515c5a6dae7057bc0ad6ae826134f", "shasum": "" }, "require": { - "cycle/database": "^2.3", + "cycle/database": "^2.5", "php": ">=8.1", "spiral/core": "^3.0", "spiral/files": "^3.0", @@ -269,9 +274,9 @@ "description": "Database migrations, migration scaffolding", "support": { "issues": "https://github.com/cycle/migrations/issues", - "source": "https://github.com/cycle/migrations/tree/v4.0.1" + "source": "https://github.com/cycle/migrations/tree/v4.1.0" }, - "time": "2023-01-03T14:02:11+00:00" + "time": "2023-05-16T08:01:38+00:00" }, { "name": "cycle/orm", @@ -328,20 +333,20 @@ }, { "name": "cycle/schema-builder", - "version": "v2.3.0", + "version": "v2.4.0", "source": { "type": "git", "url": "https://github.com/cycle/schema-builder.git", - "reference": "a639f4bf6bf03b855c150afaa8b3c611be47f826" + "reference": "ff384c11df297dac6cfc2cc57e6a9a7ae09cde16" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/schema-builder/zipball/a639f4bf6bf03b855c150afaa8b3c611be47f826", - "reference": "a639f4bf6bf03b855c150afaa8b3c611be47f826", + "url": "https://api.github.com/repos/cycle/schema-builder/zipball/ff384c11df297dac6cfc2cc57e6a9a7ae09cde16", + "reference": "ff384c11df297dac6cfc2cc57e6a9a7ae09cde16", "shasum": "" }, "require": { - "cycle/database": "^2.4", + "cycle/database": "^2.5", "cycle/orm": "^2.0", "php": ">=8.0", "yiisoft/friendly-exception": "^1.1" @@ -364,26 +369,26 @@ "description": "Cycle ORM Schema Builder", "support": { "issues": "https://github.com/cycle/schema-builder/issues", - "source": "https://github.com/cycle/schema-builder/tree/v2.3.0" + "source": "https://github.com/cycle/schema-builder/tree/v2.4.0" }, - "time": "2023-02-01T13:27:36+00:00" + "time": "2023-05-16T07:32:12+00:00" }, { "name": "cycle/schema-migrations-generator", - "version": "2.1.0", + "version": "2.1.1", "source": { "type": "git", "url": "https://github.com/cycle/schema-migrations-generator.git", - "reference": "93190e85d98c2e7cf20de9d6d51c4878dc8084de" + "reference": "92781750378c6e95ff4083d068292385292771c9" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cycle/schema-migrations-generator/zipball/93190e85d98c2e7cf20de9d6d51c4878dc8084de", - "reference": "93190e85d98c2e7cf20de9d6d51c4878dc8084de", + "url": "https://api.github.com/repos/cycle/schema-migrations-generator/zipball/92781750378c6e95ff4083d068292385292771c9", + "reference": "92781750378c6e95ff4083d068292385292771c9", "shasum": "" }, "require": { - "cycle/database": "^2.0", + "cycle/database": "^2.4.1", "cycle/migrations": "^4.0", "cycle/schema-builder": "^2.0", "php": ">=8.1" @@ -408,9 +413,9 @@ "description": "Cycle ORM Migration generation", "support": { "issues": "https://github.com/cycle/schema-migrations-generator/issues", - "source": "https://github.com/cycle/schema-migrations-generator/tree/2.1.0" + "source": "https://github.com/cycle/schema-migrations-generator/tree/2.1.1" }, - "time": "2023-01-12T10:29:49+00:00" + "time": "2023-03-08T09:23:01+00:00" }, { "name": "cycle/schema-renderer", @@ -1147,16 +1152,16 @@ }, { "name": "guzzlehttp/guzzle", - "version": "7.5.1", + "version": "7.6.1", "source": { "type": "git", "url": "https://github.com/guzzle/guzzle.git", - "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9" + "reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/guzzle/guzzle/zipball/b964ca597e86b752cd994f27293e9fa6b6a95ed9", - "reference": "b964ca597e86b752cd994f27293e9fa6b6a95ed9", + "url": "https://api.github.com/repos/guzzle/guzzle/zipball/8444a2bacf1960bc6a2b62ed86b8e72e11eebe51", + "reference": "8444a2bacf1960bc6a2b62ed86b8e72e11eebe51", "shasum": "" }, "require": { @@ -1187,9 +1192,6 @@ "bamarni-bin": { "bin-links": true, "forward-command": false - }, - "branch-alias": { - "dev-master": "7.5-dev" } }, "autoload": { @@ -1255,7 +1257,7 @@ ], "support": { "issues": "https://github.com/guzzle/guzzle/issues", - "source": "https://github.com/guzzle/guzzle/tree/7.5.1" + "source": "https://github.com/guzzle/guzzle/tree/7.6.1" }, "funding": [ { @@ -1271,7 +1273,7 @@ "type": "tidelift" } ], - "time": "2023-04-17T16:30:08+00:00" + "time": "2023-05-15T20:43:01+00:00" }, { "name": "guzzlehttp/promises", @@ -1676,16 +1678,16 @@ }, { "name": "laravel/framework", - "version": "v10.10.1", + "version": "v10.11.0", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "be0478dea96a6619bb77676f36f67c1500846b17" + "reference": "21a5b6d9b669f32c10cc8ba776511b5f62599fea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/be0478dea96a6619bb77676f36f67c1500846b17", - "reference": "be0478dea96a6619bb77676f36f67c1500846b17", + "url": "https://api.github.com/repos/laravel/framework/zipball/21a5b6d9b669f32c10cc8ba776511b5f62599fea", + "reference": "21a5b6d9b669f32c10cc8ba776511b5f62599fea", "shasum": "" }, "require": { @@ -1872,7 +1874,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2023-05-11T13:20:25+00:00" + "time": "2023-05-16T13:59:23+00:00" }, { "name": "laravel/serializable-closure", @@ -3037,23 +3039,22 @@ }, { "name": "php-http/client-common", - "version": "2.6.1", + "version": "2.7.0", "source": { "type": "git", "url": "https://github.com/php-http/client-common.git", - "reference": "665bfc381bb910385f70391ed3eeefd0b7bbdd0d" + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/client-common/zipball/665bfc381bb910385f70391ed3eeefd0b7bbdd0d", - "reference": "665bfc381bb910385f70391ed3eeefd0b7bbdd0d", + "url": "https://api.github.com/repos/php-http/client-common/zipball/880509727a447474d2a71b7d7fa5d268ddd3db4b", + "reference": "880509727a447474d2a71b7d7fa5d268ddd3db4b", "shasum": "" }, "require": { "php": "^7.1 || ^8.0", "php-http/httplug": "^2.0", "php-http/message": "^1.6", - "php-http/message-factory": "^1.0", "psr/http-client": "^1.0", "psr/http-factory": "^1.0", "psr/http-message": "^1.0 || ^2.0", @@ -3101,22 +3102,22 @@ ], "support": { "issues": "https://github.com/php-http/client-common/issues", - "source": "https://github.com/php-http/client-common/tree/2.6.1" + "source": "https://github.com/php-http/client-common/tree/2.7.0" }, - "time": "2023-04-14T13:30:08+00:00" + "time": "2023-05-17T06:46:59+00:00" }, { "name": "php-http/discovery", - "version": "1.18.0", + "version": "1.18.1", "source": { "type": "git", "url": "https://github.com/php-http/discovery.git", - "reference": "29ae6fae35f4116bbfe4c8b96ccc3f687eb07cd9" + "reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/discovery/zipball/29ae6fae35f4116bbfe4c8b96ccc3f687eb07cd9", - "reference": "29ae6fae35f4116bbfe4c8b96ccc3f687eb07cd9", + "url": "https://api.github.com/repos/php-http/discovery/zipball/f258b3a1d16acb7b21f3b42d7a2494a733365237", + "reference": "f258b3a1d16acb7b21f3b42d7a2494a733365237", "shasum": "" }, "require": { @@ -3179,9 +3180,9 @@ ], "support": { "issues": "https://github.com/php-http/discovery/issues", - "source": "https://github.com/php-http/discovery/tree/1.18.0" + "source": "https://github.com/php-http/discovery/tree/1.18.1" }, - "time": "2023-05-03T14:49:12+00:00" + "time": "2023-05-17T08:53:10+00:00" }, { "name": "php-http/httplug", @@ -3242,22 +3243,21 @@ }, { "name": "php-http/message", - "version": "1.15.0", + "version": "1.16.0", "source": { "type": "git", "url": "https://github.com/php-http/message.git", - "reference": "2a1fbaa00cf5ffc82f379adf47388663bce8190d" + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-http/message/zipball/2a1fbaa00cf5ffc82f379adf47388663bce8190d", - "reference": "2a1fbaa00cf5ffc82f379adf47388663bce8190d", + "url": "https://api.github.com/repos/php-http/message/zipball/47a14338bf4ebd67d317bf1144253d7db4ab55fd", + "reference": "47a14338bf4ebd67d317bf1144253d7db4ab55fd", "shasum": "" }, "require": { "clue/stream-filter": "^1.5", "php": "^7.2 || ^8.0", - "php-http/message-factory": "^1.0.2", "psr/http-message": "^1.1 || ^2.0" }, "provide": { @@ -3268,6 +3268,7 @@ "ext-zlib": "*", "guzzlehttp/psr7": "^1.0 || ^2.0", "laminas/laminas-diactoros": "^2.0 || ^3.0", + "php-http/message-factory": "^1.0.2", "phpspec/phpspec": "^5.1 || ^6.3 || ^7.1", "slim/slim": "^3.0" }, @@ -3305,9 +3306,9 @@ ], "support": { "issues": "https://github.com/php-http/message/issues", - "source": "https://github.com/php-http/message/tree/1.15.0" + "source": "https://github.com/php-http/message/tree/1.16.0" }, - "time": "2023-05-10T08:19:58+00:00" + "time": "2023-05-17T06:43:38+00:00" }, { "name": "php-http/message-factory", @@ -4269,16 +4270,16 @@ }, { "name": "sentry/sentry", - "version": "3.18.0", + "version": "3.18.2", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "2041f2ed3f82a55eaca31079e106c8b17c89dbda" + "reference": "c634615c09a69bfdc3bb5f6ffeee78db3711167c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/2041f2ed3f82a55eaca31079e106c8b17c89dbda", - "reference": "2041f2ed3f82a55eaca31079e106c8b17c89dbda", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/c634615c09a69bfdc3bb5f6ffeee78db3711167c", + "reference": "c634615c09a69bfdc3bb5f6ffeee78db3711167c", "shasum": "" }, "require": { @@ -4292,6 +4293,7 @@ "php-http/discovery": "^1.15", "php-http/httplug": "^1.1|^2.0", "php-http/message": "^1.5", + "php-http/message-factory": "^1.1", "psr/http-factory": "^1.0", "psr/http-factory-implementation": "^1.0", "psr/log": "^1.0|^2.0|^3.0", @@ -4357,7 +4359,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/3.18.0" + "source": "https://github.com/getsentry/sentry-php/tree/3.18.2" }, "funding": [ { @@ -4369,7 +4371,7 @@ "type": "custom" } ], - "time": "2023-05-03T10:21:22+00:00" + "time": "2023-05-17T10:56:54+00:00" }, { "name": "sentry/sentry-laravel", @@ -7648,16 +7650,16 @@ }, { "name": "wayofdev/laravel-cycle-orm-adapter", - "version": "v2.1.8", + "version": "v2.2.0", "source": { "type": "git", "url": "https://github.com/wayofdev/laravel-cycle-orm-adapter.git", - "reference": "e1239c452a1563b544bef206f471c1504b67ac14" + "reference": "38d3b6ce88a26204f6a3a3a79905fa236ccc4f8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/wayofdev/laravel-cycle-orm-adapter/zipball/e1239c452a1563b544bef206f471c1504b67ac14", - "reference": "e1239c452a1563b544bef206f471c1504b67ac14", + "url": "https://api.github.com/repos/wayofdev/laravel-cycle-orm-adapter/zipball/38d3b6ce88a26204f6a3a3a79905fa236ccc4f8a", + "reference": "38d3b6ce88a26204f6a3a3a79905fa236ccc4f8a", "shasum": "" }, "require": { @@ -7740,7 +7742,7 @@ "type": "github" } ], - "time": "2023-05-09T23:15:22+00:00" + "time": "2023-05-17T13:42:42+00:00" }, { "name": "webmozart/assert", @@ -8612,16 +8614,16 @@ }, { "name": "fakerphp/faker", - "version": "v1.21.0", + "version": "v1.22.0", "source": { "type": "git", "url": "https://github.com/FakerPHP/Faker.git", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d" + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/92efad6a967f0b79c499705c69b662f738cc9e4d", - "reference": "92efad6a967f0b79c499705c69b662f738cc9e4d", + "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/f85772abd508bd04e20bb4b1bbe260a68d0066d2", + "reference": "f85772abd508bd04e20bb4b1bbe260a68d0066d2", "shasum": "" }, "require": { @@ -8674,9 +8676,9 @@ ], "support": { "issues": "https://github.com/FakerPHP/Faker/issues", - "source": "https://github.com/FakerPHP/Faker/tree/v1.21.0" + "source": "https://github.com/FakerPHP/Faker/tree/v1.22.0" }, - "time": "2022-12-13T13:54:32+00:00" + "time": "2023-05-14T12:31:37+00:00" }, { "name": "fidry/cpu-core-counter", @@ -10128,22 +10130,23 @@ }, { "name": "phpstan/phpdoc-parser", - "version": "1.20.4", + "version": "1.21.0", "source": { "type": "git", "url": "https://github.com/phpstan/phpdoc-parser.git", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd" + "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", - "reference": "7d568c87a9df9c5f7e8b5f075fc469aa8cb0a4cd", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/6df62b08faef4f899772bc7c3bbabb93d2b7a21c", + "reference": "6df62b08faef4f899772bc7c3bbabb93d2b7a21c", "shasum": "" }, "require": { "php": "^7.2 || ^8.0" }, "require-dev": { + "nikic/php-parser": "^4.15", "php-parallel-lint/php-parallel-lint": "^1.2", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^1.5", @@ -10167,9 +10170,9 @@ "description": "PHPDoc parser with support for nullable, intersection and generic types", "support": { "issues": "https://github.com/phpstan/phpdoc-parser/issues", - "source": "https://github.com/phpstan/phpdoc-parser/tree/1.20.4" + "source": "https://github.com/phpstan/phpdoc-parser/tree/1.21.0" }, - "time": "2023-05-02T09:19:37+00:00" + "time": "2023-05-17T13:13:44+00:00" }, { "name": "phpstan/phpstan", @@ -10708,12 +10711,12 @@ "source": { "type": "git", "url": "https://github.com/Roave/SecurityAdvisories.git", - "reference": "4897b9c8b04ee19dd3d5cc40a2f35a77672bbe49" + "reference": "d1af11449398214f9664514ce705c5154ead9c38" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/4897b9c8b04ee19dd3d5cc40a2f35a77672bbe49", - "reference": "4897b9c8b04ee19dd3d5cc40a2f35a77672bbe49", + "url": "https://api.github.com/repos/Roave/SecurityAdvisories/zipball/d1af11449398214f9664514ce705c5154ead9c38", + "reference": "d1af11449398214f9664514ce705c5154ead9c38", "shasum": "" }, "conflict": { @@ -10941,7 +10944,7 @@ "laravel/framework": "<6.20.42|>=7,<7.30.6|>=8,<8.75", "laravel/socialite": ">=1,<1.0.99|>=2,<2.0.10", "latte/latte": "<2.10.8", - "lavalite/cms": "<=5.8", + "lavalite/cms": "<=9", "lcobucci/jwt": ">=3.4,<3.4.6|>=4,<4.0.4|>=4.1,<4.1.5", "league/commonmark": "<0.18.3", "league/flysystem": "<1.1.4|>=2,<2.1.1", @@ -11226,7 +11229,7 @@ "wp-graphql/wp-graphql": "<0.3.5", "wpanel/wpanel4-cms": "<=4.3.1", "wpcloud/wp-stateless": "<3.2", - "wwbn/avideo": "<12.4", + "wwbn/avideo": "<=12.4", "xataface/xataface": "<3", "xpressengine/xpressengine": "<3.0.15", "yeswiki/yeswiki": "<4.1", @@ -11308,7 +11311,7 @@ "type": "tidelift" } ], - "time": "2023-05-11T17:03:56+00:00" + "time": "2023-05-12T21:03:58+00:00" }, { "name": "sebastian/cli-parser", diff --git a/app/config/cycle.php b/app/config/cycle.php new file mode 100644 index 0000000..c1bf733 --- /dev/null +++ b/app/config/cycle.php @@ -0,0 +1,238 @@ + [ + /* + * Where should class locator scan for entities? + */ + 'directories' => [ + __DIR__ . '/../src/Domain', + ], + + /* + * Directories, to exclude from Entity search + */ + 'exclude' => [ + 'Console', + 'Exceptions', + 'Http', + 'Providers', + ], + + /* + * Scopes to use when searching for entities + */ + 'scopes' => [], + + /* + * Should class locator scan for entities in debug mode? + */ + 'debug' => env('APP_DEBUG', false), + + /* + * Should class locator cache the results? + */ + 'cache' => [ + 'directory' => null, + 'enabled' => false, + ], + ], + + 'database' => [ + /* + * Default database connection + */ + 'default' => env('DB_DEFAULT_CONNECTION', 'default'), + + /* + * The Cycle/Database module provides support to manage multiple databases + * in one application, use read/write connections and logically separate + * multiple databases within one connection using prefixes. + * + * To register a new database simply add a new one into + * "databases" section below. + */ + 'databases' => [ + 'default' => [ + 'driver' => env('DB_CONNECTION', 'sqlite'), + ], + ], + + /* + * Configuring connections, see: + * https://cycle-orm.dev/docs/database-connect/2.x/en + * + * Each database instance must have an associated connection object. + * Connections used to provide low-level functionality and wrap different + * database drivers. To register a new connection you have to specify + * the driver class and its connection options. + */ + 'drivers' => [ + /* + * Setup sqlite database in-memory for testing purposes + */ + 'sqlite' => new Config\SQLiteDriverConfig( + connection: new Config\SQLite\MemoryConnectionConfig(), + queryCache: true + ), + + 'pgsql' => new Config\PostgresDriverConfig( + connection: new Config\Postgres\TcpConnectionConfig( + database: env('DB_DATABASE', 'wod'), + host: env('DB_HOST', '127.0.0.1'), + port: (int) env('DB_PORT', 5432), + user: env('DB_USERNAME', 'wod'), + password: env('DB_PASSWORD', '') + ), + schema: Config\PostgresDriverConfig::DEFAULT_SCHEMA, + driver: Driver\Postgres\PostgresDriver::class, + reconnect: true, + timezone: 'UTC', + queryCache: true + ), + + 'mysql' => new Config\MySQLDriverConfig( + connection: new Config\MySQL\TcpConnectionConfig( + database: env('DB_DATABASE', 'wod'), + host: env('DB_HOST', '127.0.0.1'), + port: (int) env('DB_PORT', 3306), + user: env('DB_USERNAME', 'wod'), + password: env('DB_PASSWORD', '') + ), + driver: Driver\MySQL\MySQLDriver::class, + reconnect: true, + timezone: 'UTC', + queryCache: true, + ), + + 'sqlserver' => new Config\SQLServerDriverConfig( + connection: new Config\SQLServer\TcpConnectionConfig( + database: env('DB_DATABASE', 'wod'), + host: env('DB_HOST', '127.0.0.1'), + port: (int) env('DB_PORT', 1433), + user: env('DB_USERNAME', 'wod'), + password: env('DB_PASSWORD', '') + ), + driver: Driver\SQLServer\SQLServerDriver::class, + reconnect: true, + timezone: 'UTC', + queryCache: true, + ), + ], + ], + + 'schema' => [ + /* + * true (Default) - Schema will be stored in a cache after compilation. + * It won't be changed after entity modification. Use `php app.php cycle` to update schema. + * + * false - Schema won't be stored in a cache after compilation. + * It will be automatically changed after entity modification. (Development mode) + */ + 'cache' => [ + 'enabled' => env('CYCLE_SCHEMA_CACHE', true), + 'store' => env('CACHE_DRIVER', 'file'), + ], + + /* + * The CycleORM provides the ability to manage default settings for + * every schema with not defined segments + */ + 'defaults' => [ + SchemaInterface::MAPPER => \Cycle\ORM\Mapper\Mapper::class, + SchemaInterface::REPOSITORY => \Cycle\ORM\Select\Repository::class, + SchemaInterface::SCOPE => null, + SchemaInterface::TYPECAST_HANDLER => [ + // \Cycle\ORM\Parser\Typecast::class, \App\Infrastructure\CycleORM\Typecaster\UuidTypecast::class, + ], + ], + + 'collections' => [ + 'default' => env('DB_DEFAULT_COLLECTION', 'illuminate'), + 'factories' => [ + 'array' => Collection\ArrayCollectionFactory::class, + 'illuminate' => Collection\IlluminateCollectionFactory::class, + 'doctrine' => Collection\DoctrineCollectionFactory::class, + ], + ], + + /* + * Schema generators (Optional) + * null (default) - Will be used schema generators defined in bootloaders + */ + 'generators' => [ + GeneratorLoader::GROUP_INDEX => [ + // Register embeddable entities + Annotated\Embeddings::class, + // Register annotated entities + Annotated\Entities::class, + // Register STI/JTI + Annotated\TableInheritance::class, + // Add @Table column declarations + Annotated\MergeColumns::class, + ], + GeneratorLoader::GROUP_RENDER => [ + // Re-declared table schemas (remove columns) + Schema\Generator\ResetTables::class, + // Generate entity relations + Schema\Generator\GenerateRelations::class, + // Generate changes from schema modifiers + Schema\Generator\GenerateModifiers::class, + // Make sure all entity schemas are correct + Schema\Generator\ValidateEntities::class, + // Declare table schemas + Schema\Generator\RenderTables::class, + // Declare relation keys and indexes + Schema\Generator\RenderRelations::class, + // Render all schema modifiers + Schema\Generator\RenderModifiers::class, + // Add @Table column declarations + Annotated\MergeIndexes::class, + ], + GeneratorLoader::GROUP_POSTPROCESS => [ + // Typecast non string columns + Schema\Generator\GenerateTypecast::class, + ], + ], + ], + + 'migrations' => [ + 'directory' => database_path('migrations/cycle'), + + 'table' => env('DB_MIGRATIONS_TABLE', 'cycle_migrations'), + + 'safe' => env('APP_ENV') !== 'production', + ], + + /* + * Enable schema cache warmup + */ + 'warmup' => env('CYCLE_SCHEMA_WARMUP', false), + + /* + * Custom relation types for entities + */ + 'customRelations' => [ + // \Cycle\ORM\Relation::EMBEDDED => [ + // \Cycle\ORM\Config\RelationConfig::LOADER => \Cycle\ORM\Select\Loader\EmbeddedLoader::class, + // \Cycle\ORM\Config\RelationConfig::RELATION => \Cycle\ORM\Relation\Embedded::class, + // ], + ], +]; diff --git a/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php b/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php new file mode 100644 index 0000000..ca836d7 --- /dev/null +++ b/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php @@ -0,0 +1,42 @@ +table('users') + ->addColumn('incremental_id', 'bigInteger', ['nullable' => false, 'default' => null]) + ->addColumn('email', 'string', ['nullable' => true, 'default' => null, 'size' => 255]) + ->addColumn('company', 'string', ['nullable' => true, 'default' => null, 'size' => 255]) + ->addColumn('name', 'string', ['nullable' => false, 'default' => null, 'size' => 255]) + ->setPrimaryKeys(['incremental_id']) + ->create(); + $this->table('roles') + ->addColumn('id', 'primary', ['nullable' => false, 'default' => null]) + ->addColumn('name', 'string', ['nullable' => false, 'default' => null, 'size' => 255]) + ->addColumn('user_incrementalId', 'bigInteger', ['nullable' => false, 'default' => null]) + ->addIndex(['user_incrementalId'], ['name' => 'roles_index_user_incrementalid_646522feb8e5f', 'unique' => false]) + ->addForeignKey(['user_incrementalId'], 'users', ['incremental_id'], [ + 'name' => 'roles_foreign_user_incrementalid_646522feb8e6c', + 'delete' => 'CASCADE', + 'update' => 'CASCADE', + 'indexCreate' => true, + ]) + ->setPrimaryKeys(['id']) + ->create(); + } + + public function down(): void + { + $this->table('roles')->drop(); + $this->table('users')->drop(); + } +} diff --git a/app/src/Domain/Role/Role.php b/app/src/Domain/Role/Role.php new file mode 100644 index 0000000..14db898 --- /dev/null +++ b/app/src/Domain/Role/Role.php @@ -0,0 +1,23 @@ +name = $name; + } +} diff --git a/app/src/Domain/Role/RoleRepository.php b/app/src/Domain/Role/RoleRepository.php new file mode 100644 index 0000000..b2d4386 --- /dev/null +++ b/app/src/Domain/Role/RoleRepository.php @@ -0,0 +1,12 @@ + - */ - protected $fillable = [ - 'name', - 'email', - 'password', - ]; - - /** - * The attributes that should be hidden for serialization. - * - * @var array - */ - protected $hidden = [ - 'password', - 'remember_token', - ]; - - /** - * The attributes that should be cast. - * - * @var array - */ - protected $casts = [ - 'email_verified_at' => 'datetime', - ]; -} diff --git a/app/src/Domain/User/User.php b/app/src/Domain/User/User.php index e69de29..db6d931 100644 --- a/app/src/Domain/User/User.php +++ b/app/src/Domain/User/User.php @@ -0,0 +1,46 @@ +roles = new Collection(); + } + + public function getName(): string + { + return $this->name; + } +} diff --git a/app/src/Domain/User/UserRepository.php b/app/src/Domain/User/UserRepository.php new file mode 100644 index 0000000..90f6032 --- /dev/null +++ b/app/src/Domain/User/UserRepository.php @@ -0,0 +1,12 @@ + Date: Wed, 17 May 2023 20:02:08 +0300 Subject: [PATCH 08/10] style: apply fixes --- ..._0_0_default_create_roles_create_users.php | 36 +++++++++---------- app/src/Domain/User/User.php | 5 ++- 2 files changed, 20 insertions(+), 21 deletions(-) diff --git a/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php b/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php index ca836d7..277cf3b 100644 --- a/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php +++ b/app/database/migrations/cycle/20230517.185454_0_0_default_create_roles_create_users.php @@ -13,25 +13,25 @@ class OrmDefault9296507f0aee2fd6fb380d0901b971a3 extends Migration public function up(): void { $this->table('users') - ->addColumn('incremental_id', 'bigInteger', ['nullable' => false, 'default' => null]) - ->addColumn('email', 'string', ['nullable' => true, 'default' => null, 'size' => 255]) - ->addColumn('company', 'string', ['nullable' => true, 'default' => null, 'size' => 255]) - ->addColumn('name', 'string', ['nullable' => false, 'default' => null, 'size' => 255]) - ->setPrimaryKeys(['incremental_id']) - ->create(); + ->addColumn('incremental_id', 'bigInteger', ['nullable' => false, 'default' => null]) + ->addColumn('email', 'string', ['nullable' => true, 'default' => null, 'size' => 255]) + ->addColumn('company', 'string', ['nullable' => true, 'default' => null, 'size' => 255]) + ->addColumn('name', 'string', ['nullable' => false, 'default' => null, 'size' => 255]) + ->setPrimaryKeys(['incremental_id']) + ->create(); $this->table('roles') - ->addColumn('id', 'primary', ['nullable' => false, 'default' => null]) - ->addColumn('name', 'string', ['nullable' => false, 'default' => null, 'size' => 255]) - ->addColumn('user_incrementalId', 'bigInteger', ['nullable' => false, 'default' => null]) - ->addIndex(['user_incrementalId'], ['name' => 'roles_index_user_incrementalid_646522feb8e5f', 'unique' => false]) - ->addForeignKey(['user_incrementalId'], 'users', ['incremental_id'], [ - 'name' => 'roles_foreign_user_incrementalid_646522feb8e6c', - 'delete' => 'CASCADE', - 'update' => 'CASCADE', - 'indexCreate' => true, - ]) - ->setPrimaryKeys(['id']) - ->create(); + ->addColumn('id', 'primary', ['nullable' => false, 'default' => null]) + ->addColumn('name', 'string', ['nullable' => false, 'default' => null, 'size' => 255]) + ->addColumn('user_incrementalId', 'bigInteger', ['nullable' => false, 'default' => null]) + ->addIndex(['user_incrementalId'], ['name' => 'roles_index_user_incrementalid_646522feb8e5f', 'unique' => false]) + ->addForeignKey(['user_incrementalId'], 'users', ['incremental_id'], [ + 'name' => 'roles_foreign_user_incrementalid_646522feb8e6c', + 'delete' => 'CASCADE', + 'update' => 'CASCADE', + 'indexCreate' => true, + ]) + ->setPrimaryKeys(['id']) + ->create(); } public function down(): void diff --git a/app/src/Domain/User/User.php b/app/src/Domain/User/User.php index db6d931..38b4f36 100644 --- a/app/src/Domain/User/User.php +++ b/app/src/Domain/User/User.php @@ -20,9 +20,6 @@ )] final class User { - #[Column(type: 'bigInteger', primary: true)] - private ?int $incrementalId = null; - #[Column(type: 'string', nullable: true)] public ?string $email = null; @@ -31,6 +28,8 @@ final class User #[HasMany(target: Role::class)] public Collection $roles; + #[Column(type: 'bigInteger', primary: true)] + private ?int $incrementalId = null; public function __construct( #[Column(type: 'string')] From 7bf270a730dad82e49a25d7791baacc6f866c050 Mon Sep 17 00:00:00 2001 From: lotyp Date: Thu, 18 May 2023 13:29:23 +0300 Subject: [PATCH 09/10] fix: phpstan errors --- app/config/auth.php | 9 ++------- app/config/cycle.php | 6 +++--- .../Bridge/Laravel/Providers/RouteServiceProvider.php | 2 +- app/src/Domain/User/User.php | 7 ++++++- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/app/config/auth.php b/app/config/auth.php index 86165fd..96c50ef 100644 --- a/app/config/auth.php +++ b/app/config/auth.php @@ -52,14 +52,9 @@ */ 'providers' => [ 'users' => [ - 'driver' => 'eloquent', - 'model' => \Domain\User\Models\User::class, + 'driver' => 'database', + 'table' => 'users', ], - - // 'users' => [ - // 'driver' => 'database', - // 'table' => 'users', - // ], ], /* diff --git a/app/config/cycle.php b/app/config/cycle.php index c1bf733..33743b6 100644 --- a/app/config/cycle.php +++ b/app/config/cycle.php @@ -97,7 +97,7 @@ connection: new Config\Postgres\TcpConnectionConfig( database: env('DB_DATABASE', 'wod'), host: env('DB_HOST', '127.0.0.1'), - port: (int) env('DB_PORT', 5432), + port: env('DB_PORT', 5432), user: env('DB_USERNAME', 'wod'), password: env('DB_PASSWORD', '') ), @@ -112,7 +112,7 @@ connection: new Config\MySQL\TcpConnectionConfig( database: env('DB_DATABASE', 'wod'), host: env('DB_HOST', '127.0.0.1'), - port: (int) env('DB_PORT', 3306), + port: env('DB_PORT', 3306), user: env('DB_USERNAME', 'wod'), password: env('DB_PASSWORD', '') ), @@ -126,7 +126,7 @@ connection: new Config\SQLServer\TcpConnectionConfig( database: env('DB_DATABASE', 'wod'), host: env('DB_HOST', '127.0.0.1'), - port: (int) env('DB_PORT', 1433), + port: env('DB_PORT', 1433), user: env('DB_USERNAME', 'wod'), password: env('DB_PASSWORD', '') ), diff --git a/app/src/Bridge/Laravel/Providers/RouteServiceProvider.php b/app/src/Bridge/Laravel/Providers/RouteServiceProvider.php index ddc3ab7..a9f8970 100644 --- a/app/src/Bridge/Laravel/Providers/RouteServiceProvider.php +++ b/app/src/Bridge/Laravel/Providers/RouteServiceProvider.php @@ -27,7 +27,7 @@ final class RouteServiceProvider extends ServiceProvider public function boot(): void { RateLimiter::for('api', function (Request $request) { - return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); + return Limit::perMinute(60)->by($request->user()?->incrementalId ?: $request->ip()); }); $this->routes(function (): void { diff --git a/app/src/Domain/User/User.php b/app/src/Domain/User/User.php index 38b4f36..76807b9 100644 --- a/app/src/Domain/User/User.php +++ b/app/src/Domain/User/User.php @@ -38,7 +38,12 @@ public function __construct( $this->roles = new Collection(); } - public function getName(): string + public function incrementalId(): ?int + { + return $this->incrementalId; + } + + public function name(): string { return $this->name; } From 1f772ae966cf6e4b063f3f8cde74198272e6f459 Mon Sep 17 00:00:00 2001 From: lotyp Date: Thu, 18 May 2023 14:11:20 +0300 Subject: [PATCH 10/10] feat: use cycle migrations when deploying --- .../2014_10_12_000000_create_users_table.php | 33 ------------------- ...000_create_password_reset_tokens_table.php | 29 ---------------- ..._08_19_000000_create_failed_jobs_table.php | 33 ------------------- app/deploy.php | 7 +++- 4 files changed, 6 insertions(+), 96 deletions(-) delete mode 100644 app/database/migrations/2014_10_12_000000_create_users_table.php delete mode 100644 app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php delete mode 100644 app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php diff --git a/app/database/migrations/2014_10_12_000000_create_users_table.php b/app/database/migrations/2014_10_12_000000_create_users_table.php deleted file mode 100644 index b4d4f56..0000000 --- a/app/database/migrations/2014_10_12_000000_create_users_table.php +++ /dev/null @@ -1,33 +0,0 @@ -id(); - $table->string('name'); - $table->string('email')->unique(); - $table->timestamp('email_verified_at')->nullable(); - $table->string('password'); - $table->rememberToken(); - $table->timestamps(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('users'); - } -}; diff --git a/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php b/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php deleted file mode 100644 index 0560927..0000000 --- a/app/database/migrations/2014_10_12_100000_create_password_reset_tokens_table.php +++ /dev/null @@ -1,29 +0,0 @@ -string('email')->primary(); - $table->string('token'); - $table->timestamp('created_at')->nullable(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('password_reset_tokens'); - } -}; diff --git a/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php b/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php deleted file mode 100644 index 0b9878e..0000000 --- a/app/database/migrations/2019_08_19_000000_create_failed_jobs_table.php +++ /dev/null @@ -1,33 +0,0 @@ -id(); - $table->string('uuid')->unique(); - $table->text('connection'); - $table->text('queue'); - $table->longText('payload'); - $table->longText('exception'); - $table->timestamp('failed_at')->useCurrent(); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - Schema::dropIfExists('failed_jobs'); - } -}; diff --git a/app/deploy.php b/app/deploy.php index 5c1cde0..3d870d8 100644 --- a/app/deploy.php +++ b/app/deploy.php @@ -44,6 +44,11 @@ function getDefaultEnv(mixed $variable, mixed $default = null) before('deploy', 'slack:notify'); +task('artisan:cycle:migrate', function () { + cd('{{release_or_current_path}}'); + run('php artisan cycle:migrate'); +}); + task('deploy', [ 'deploy:prepare', 'deploy:vendors', @@ -52,7 +57,7 @@ function getDefaultEnv(mixed $variable, mixed $default = null) 'artisan:route:cache', 'artisan:view:cache', 'artisan:event:cache', - 'artisan:migrate', + 'artisan:cycle:migrate', 'deploy:publish', ]);