Create development data
Declare an App fixture, run it with the CLI, and check safe replay.
Create development data
Development fixtures are explicitly selected by the developer; they are not mandatory installation defaults. Start with Workshop from Create an App package and an active development sandbox.
Prepare a Resource
Run this in the App folder. Do not regenerate an existing Resource with the same name.
nexia make resource Example --record-owner tenant --label-ko 예제This Resource is tenant-owned. The current sandbox fixture context supplies empty legalEntities() and subjects() lists. Do not invent a default legal entity, create accounts, or copy production database records. Organization-owned fixtures need explicit App-supported organization resolution and authorization.
Declare the fixture
Create src/Contribution/WorkshopFixtures.php. Substitute the namespace, App key and model for another App. The generated Manifest already discovers this directory. One fixture contribution per App can handle multiple keys.
<?php
declare(strict_types=1);
namespace Nexia\Apps\Acme\Workshop\Contribution;
use InvalidArgumentException;
use Nexia\Apps\Acme\Workshop\Models\Example;
use Nexia\Fixture\Contracts\FixtureContribution;
use Nexia\Fixture\FixtureContext;
final class WorkshopFixtures implements FixtureContribution
{
public function appKey(): string { return 'workshop'; }
public function fixtureKeys(): array { return ['sample']; }
public function seed(FixtureContext $context): void
{
if ($context->fixtureKey !== 'sample') {
throw new InvalidArgumentException('Unsupported fixture.');
}
Example::firstOrCreate(
['public_id' => '7ce124d3-2f58-43cf-b794-16922527902c'],
['name' => 'Sample example'],
);
}
}The fixed public UUID makes replay preserve both record identity and a user-edited name. Keep the generated model's unique public UUID constraint. The platform restores the actor in FixtureContext; App code does not supply tokens or database credentials. Use synthetic records without customer data or secrets.
Run and verify
- Wait for
nexia devto synchronize the Resource and fixture and finish preparation. - Stop the watcher with Ctrl+C. Run in the App folder:
nexia db seed sample
nexia db status- Wait for
completed, then restartnexia dev. - In workspace Settings → Credentials and access, place Example read/update permissions in a role and assign it to your user. Confirm the App's Examples list contains one record.
- Rename the record, repeat this procedure, and confirm there is still one record with the edited name.
Accepted or queued is not completed. If the key is missing, check contribution discovery, appKey() and the prepared source revision. Request support for needs_review; do not reset the database. This recipe is source-backed; verify its actual execution in your App separately.
Separate mandatory defaults
Use Required installation content for codes or defaults required for the first business operation. Keep sample records out of initializers. Local test fixtures in Test an App are also separate from retained remote sandbox data.