Overview
Database seeding refers to populating the database with initial reference data, catalogs, and system configurations required for the application to function properly. Seed data is stored in thesource/DB/DML/ directory.
Seed Files
Core System Data
User Roles
User Roles
Defines the system roles for access control.Role Descriptions:
- admin - Full system access and configuration
- vendedor - Sales representative, manages leads and quotes
- gerente - Manager, approves requests and reviews
- cliente - Customer portal access
- recepcionista - Receptionist, basic data entry
- supervisor - Oversees operations
- operaciones - Operations team, service fulfillment
- cobros - Collections team, payment management
Customer Status
Customer Status
Defines possible customer account states.Status Meanings:
- Activo - Active customer, can place orders
- Inactivo - Inactive customer, no recent activity
- Suspendido - Suspended, blocked from new orders
User Status
User Status
Defines user account states.
License Types
License Types
Driver’s license categories for Guatemala.License Categories:
- Type A - Heavy cargo transport (>3.5 tons)
- Type B - Professional driver (≤3.5 tons)
- Type C - Personal vehicles (≤3.5 tons)
- Type M - Motorcycles
- Type E - Agricultural/industrial machinery
Document Types
Document Types
Valid identification document types.
System Modules
Application Modules
Application Modules
Defines the main application modules for the navigation system.
Role-Module Permissions
Role-Module Permissions
Assigns module access permissions to roles.
Service Request Configuration
Service Request Status
Service Request Status
Defines the workflow states for service requests.Status Workflow:
- lead (0) - Initial service request created
- lead (1) - Request form completed
- ops (2) - Under operations review for availability
- approval (3) - Awaiting quotation approval (blocked)
- requestManager (4) - Escalated to manager for approval
Payment Configuration
Banks Catalog
Banks Catalog
List of banks in Guatemala for payment processing.
Product Categories
Product Categories
Product Categories
Initial product categories with SKU prefixes.Category Structure:
- Each category has a unique SKU prefix for automatic code generation
sort_orderdetermines display order in UI- “Otros” category acts as fallback with high sort order
Notification System
Notification Channels
Notification Channels
Defines available notification delivery channels.
Geographic Data
TheDML_Departments.sql file contains geographic data for Guatemala:
Running Seed Scripts
Order of Execution
- DML_Departments.sql - Geographic data (no dependencies)
- DML.sql - Core system data (depends on departments)
Execution Command
Verification
After seeding, verify the data:Best Practices
Idempotent Seeds
Use
ON CONFLICT DO NOTHING or WHERE NOT EXISTS to make seed scripts rerunnable.Reference IDs
Explicitly set IDs for reference data to ensure consistency across environments.
Version Control
Keep seed files in version control alongside migrations.
Environment-Specific
Some seed data may differ between development, staging, and production.
Environment-Specific Seeds
Development
Production
Next Steps
Migrations
Learn about schema migrations
Schema Overview
Understand the database architecture