seeders-donnees-test

Manages Laravel database seeders and super-admin bootstrap for Toollab environments.

Updated May 5, 2025
One-click install
npx skills add https://github.com/sebauvray/toollab-api --skill seeders-donnees-test-sebauvray
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: seeders-donnees-test
Source: https://github.com/sebauvray/toollab-api/tree/main/.claude/skills/seeders-donnees-test
Command: npx skills add https://github.com/sebauvray/toollab-api --skill seeders-donnees-test-sebauvray

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Resetting or initializing a Toollab database requires knowing which of the six seeders to run, in what order, and how to create the first super-admin on an empty base where no in-app signup exists. Running the wrong seeder in production injects demo data, and skipping RoleSeeder breaks school creation with a 500 error. ## Core Features & Use Cases - Seeder selection guide: Documents the role of each seeder (RoleSeeder, ToollabSeeder, DemoSeeder, AlQalamSeeder, ProductionSeeder, DatabaseSeeder) and which are safe for production versus dev-only. - Super-admin bootstrap: Explains the idempotent toollab:create-super-admin Artisan command that creates or resets super-admin accounts derived from the SUPER_ADMIN_EMAILS env variable. - Ready-to-run sequences: Provides copy-paste command sequences for dev reset with demo data, clean dev base, and production initialization of a new instance. - Use Case: A developer needs a realistic multi-school, multi-year dataset with closed school years to test archive and read-only features; the Skill directs them to DemoSeeder and explains its invariants and purge safeguards. ## Quick Start Ask the assistant to reset the dev database with demo data or to initialize a fresh production instance, and it will provide the exact Artisan commands to run.

Frequently Asked Questions about seeders-donnees-test

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I reset a Laravel database with test data in Docker?▼

Run `docker exec api_dev_toollab php artisan migrate:fresh --seed --force` to rebuild the schema and load the demo dataset. For a clean base without fake data, run migrate:fresh, then seed only ProductionSeeder, then create a super-admin.

Which Laravel seeder is safe to run in production?▼

Only ProductionSeeder is safe for production; it calls RoleSeeder, which creates the six required roles. Never run `db:seed` without `--class` in production, because DatabaseSeeder would inject the demo dataset.

How do I create the first super-admin on an empty Laravel database?▼

Run `php artisan toollab:create-super-admin --password=...` via Artisan. The command is idempotent, processes all emails in SUPER_ADMIN_EMAILS when no argument is given, and resets the password if the account already exists.

Why does POST /api/schools return a 500 error on a fresh database?▼

The error occurs because the roles table is empty: the code looks up the director role and gets null. Running RoleSeeder fixes it; it is idempotent via firstOrCreate on the role slug.

Why does my Laravel seeder create no records with global scopes?▼

Seeders run without HTTP context, so school and school-year global scopes return zero rows. Set `current_school_id` and `current_school_year_id` on request attributes before writing scoped data, or use withoutGlobalScopes for reads.

Can DemoSeeder delete real production data?▼

No. DemoSeeder only runs in local or testing environments and refuses to purge any school that has a SIRET or a mismatched name. It validates the full purge list before executing any DELETE, so real client schools are never touched.