Fix bin/publish: use correct .env path for rspade_system Fix bin/publish script: prevent grep exit code 1 from terminating script 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2.5 KiB
Executable File
2.5 KiB
Executable File
Database System Documentation
Migration Policy
- Forward-only migrations - No rollbacks, no down() methods
- Use migration snapshots for development safety (migrate:begin/commit/rollback)
- All migrations must be created via artisan - Manual creation is blocked by whitelist
- Use
php artisan make:migration:safeto create whitelisted migrations
- Use
- Sequential execution only - No --path option allowed
- Fail on errors - No fallback to old schemas, migrations must succeed or fail loudly
Database Rules
- No mass assignment: All fields assigned explicitly
- No eager loading: ALL eager loading methods throw exceptions - use explicit queries for relationships
- Note: Premature optimization is the root of all evil. When you have thousands of concurrent users in production and N+1 queries become a real bottleneck, you'll be motivated enough to remove these restrictions yourself.
- Forward-only migrations: No down() methods
Naming Conventions
- Primary keys: All tables must have
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY(exception: sessions table uses Laravel's VARCHAR id) - Foreign keys: Always suffix with
_id(e.g.,user_id,site_id) - Boolean columns: Always prefix with
is_(e.g.,is_active,is_published) - Timestamp columns: Always suffix with
_at(e.g.,created_at,updated_at,deleted_at) - Integer types: Use BIGINT for all integers, TINYINT(1) for booleans only
- No unsigned integers: All integers should be signed for easier migrations
- UTF-8 encoding: All text columns use UTF-8 (utf8mb4_unicode_ci collation)
Schema Rules
- BIGINT ID required: ALL tables must have
id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY- no exceptions (SIGNED for easier migrations) - Raw SQL migrations: Use DB::statement() with raw MySQL, not Laravel schema builder
- Restricted commands: Several dangerous commands disabled (migrate:rollback, db:wipe, etc.)
- Required columns enforced: All tables have created_by, updated_by, etc.
- UTF-8 encoding standard: All text columns use UTF-8
Migration Commands
php artisan make:migration:safe # Create whitelisted migration
php artisan migrate:begin # Start migration snapshot session
php artisan migrate # Run migrations with safety checks
php artisan migrate:commit # Commit migration changes
php artisan migrate:rollback # Rollback to snapshot (stays in session)