Download the PHP package neighborhoods/kojo-phinx-templates without Composer
On this page you can find all versions of the php package neighborhoods/kojo-phinx-templates. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download neighborhoods/kojo-phinx-templates
More information about neighborhoods/kojo-phinx-templates
Files in neighborhoods/kojo-phinx-templates
Package kojo-phinx-templates
Short Description Phinx templates for Kōjō.
License MIT
Informations about the package kojo-phinx-templates
Phinx templates for Kōjō
A developer utility to generate Kōjō related Phinx migrations and seeds.
Install
Via Composer as a development dependency
You should also have Phinx and Kōjō as direct dependencies. Don't rely on this package pulling them in, especially since this is a dev dependency.
This package requires Phinx 0.12.5 or above. If you're having issues with running the command above, send the composer.json
file to the code owner.
Use cases
Possible use cases are described below.
Kōjō setup
Create migration for Kōjō setup. Every project using Kōjō should have it.
If you open the file you'll see that the template assumes that Kōjō parameters are located in the kojo-environment
folder inside the current working directly.
That's because the kojo-environment
folder is usually located in the application root from where migrations are usually run using vendor/bin/phinx migrate
command.
You might need to update the path to Kōjō parameters. If so, consider defining it relative to the migration file, using the __DIR__
constant.
Job Type Creation
For each new worker generate a migration defining the job type. In these examples the worker name is Observer. Use something more descriptive, like the component name.
Open the generated migration, update the job type attributes. The values in the migration should not depend on other classes. Copy constant values, rather than referencing them.
Thanks to @jpmarcotte for insights on this one.
Job Scheduling
If it makes sense, create a seeder scheduling the job. This is useful for jobs rescheduling themselves, providing a way to start the initial job.
Open the generated seeder and update the JOB_TYPE_CODE
constant.
Run the generated seeder whenever you want to start the job.
Jobs rescheduling themselves should be seeded after their job type creation. Integrating the seeding into migrations simplifies the deployment process and ensures the job is seeded only once.
Generate a seeding migration by running the command below.
Open the generated migration and update the Seed class name in the required seed file path, up()
and down()
methods.