A tiny seeding helper for Neos Flow applications. It provides a CLI command to initialize a database with a set of SQL files and optional follow‑up commands, orchestrated via Flow settings. This is intended for first‑time bootstrap of an environment (e.g. CI, demo or developer machines).
- Declarative jobs configured in Settings.yaml
- Import ordered SQL files (by numeric keys)
- Optional follow‑up shell/Flow commands after import
- Safe‑guard: skips when your database already contains
flow_doctrine_migrationstatus
- PHP compatible with your Neos/Flow version
- Neos Flow (package type
neos-package)
Add the package via Composer (as part of your Flow distribution):
composer require fucodo/seedThe package key is fucodo.seed.
Define one or more seeding jobs under fucodo.seed.jobs. Each job can
- be enabled/disabled
- list SQL files to import (in order)
- optionally list commands to execute after SQL import
Example minimal configuration (place into Configuration/Settings.fucodo.seed.yaml in your distribution or in a package):
fucodo:
seed:
jobs:
default:
enabled: true
databaseImports:
100:
file: 'resource://fucodo.seed/Seed/000-examplefile.sql'Example from a real package using resource URIs and a follow‑up command:
fucodo:
seed:
jobs:
default:
enabled: true
databaseImports:
100:
file: 'resource://SBS.SingleSignOn/Seed/100-basic-structure.sql'Notes:
- Keys (100, 101, 500, …) control the execution order; only their ordering matters.
- A
databaseImports.NNN.enabled: falseflag can be set to skip an entry temporarily. - Files can be absolute paths or Flow resource URIs (
resource://Vendor.Package/Path/To/File.sql). - Files can also be urls, if file_get_contents() is allowed to make http requests.
- If a target database already has the table
flow_doctrine_migrationstatus, the seeding job will abort early and not import again.
The package registers a CLI command in Flow. From your distribution root, run:
./flow seed:dataTo run a specific job (defaults to default):
./flow seed:data --job yourJobName
# or positional in some shells / Flow versions
./flow seed:data yourJobNameExit codes:
- 0: success (or skipped because database looked already initialized)
- 1: job disabled (or other StopCommand condition)
During execution you will see which files are imported. Empty files are reported and skipped.
Internally, SeedCommandController:
- Creates a Doctrine DBAL connection from
Neos.Flow.persistence.backendOptions. - Checks for the presence of the
flow_doctrine_migrationstatustable. - Iterates your configured
databaseImportsand runs each file withexecuteStatement. - Prints a short progress line per step.
- Place seed SQL files in your package under
Resources/Seed/and refer to them using the Flowresource://scheme. - Keep imports idempotent where possible; the safety check prevents re‑seeding but it is still good to make scripts re‑runnable.
- Use small, ordered files focused on a single concern (schema bootstrap, minimal data, fixtures, …).
This package is intentionally small. PRs improving documentation and robustness are welcome.
MIT (or the same as your project distribution).