Laravel's console Command implementation allows commands to run in isolation. Essentially it means an isolated command can't have more than one active process. A typical use case is when there's some parallelism in a system and command is not mean to be run multiple times let alone in parallel. Database migration is another example when isolation is needed.
Normally, in a single instance deployment this is not an issue. However, Winter CMS may be used in a multi-server setup, when some CI/CD tool runs a parallel deployment (e.g. using Kubernetes etc), leading to winter:up command being called automatically more than once.
The simplest solution is to rely on the built-in support and --isolated option to the migration command which can be achieved by just implementing Isolatable interface (which has no methods at all).
Steps to replicate
Create a non-idempotent migration (like "CREATE TABLE ...")
Run it in a multi-server deployment, making sure it's executed in parallel.
Observe the failure of the 2nd and other instances who attempted to run the migration (because they all started at the same time and "thought" they had to run it)
Winter CMS Build
dev-develop
PHP Version
8.1
Database engine
MySQL/MariaDB
Plugins installed
No response
Issue description
Laravel's console
Command
implementation allows commands to run in isolation. Essentially it means an isolated command can't have more than one active process. A typical use case is when there's some parallelism in a system and command is not mean to be run multiple times let alone in parallel. Database migration is another example when isolation is needed.Normally, in a single instance deployment this is not an issue. However, Winter CMS may be used in a multi-server setup, when some CI/CD tool runs a parallel deployment (e.g. using Kubernetes etc), leading to
winter:up
command being called automatically more than once.The simplest solution is to rely on the built-in support and
--isolated
option to the migration command which can be achieved by just implementingIsolatable
interface (which has no methods at all).Steps to replicate
Workaround
No response