- How does this package handle the 'Cannot add a NOT NULL column with default value NULL' error in SQLite?
- The package automatically rewrites migrations to first add the column as nullable, then updates it to non-nullable in a separate step. This avoids SQLite’s strict constraint violations while preserving your intended schema. You don’t need to manually split migrations—just use the trait.
- Will this work with Laravel 9 or 10? The README mentions Laravel 8+.
- The package is tested with Laravel 8+, and since it only extends Laravel’s core migration system, it should work with Laravel 9 and 10 without issues. However, always verify compatibility by testing migrations in your specific Laravel version before full adoption.
- Can I use this package in production, or is it only for development?
- This package is installed as a `--dev` dependency, meaning it won’t affect production builds. However, its purpose is to ensure SQLite migrations work correctly, so you can safely use it in both development and staging environments where SQLite is used.
- Does this package support rollbacks for transformed migrations?
- Yes, rollbacks are handled automatically. If a migration adds a column as nullable then updates it to non-nullable, the rollback will reverse these steps in the correct order. However, always test rollbacks in a staging environment to confirm behavior matches expectations.
- What happens if I mix transformed and non-transformed migrations?
- Mixing transformed and non-transformed migrations can lead to inconsistencies, especially if the same table is modified in both. To avoid issues, apply the trait consistently across all migrations for a given table or use it selectively only where SQLite-specific errors occur.
- Are there performance implications of using this trait?
- The trait adds minimal overhead since it only transforms migrations at runtime. The performance impact is negligible for most use cases, especially in development environments. In production, if you’re not using SQLite, the package won’t execute at all.
- How do I handle unsupported Laravel datatypes like ENUM or JSONB in SQLite?
- The package automatically converts unsupported datatypes to SQLite-compatible equivalents (e.g., ENUM becomes TEXT, JSONB becomes TEXT). You don’t need to manually rewrite your migration code—just include the trait, and it handles the translation.
- Can I use this package with other Laravel packages that modify migrations?
- Yes, but test thoroughly. If other packages (like spatie/laravel-permission) also modify migrations, ensure there are no conflicts. The trait should work alongside most packages, but complex interactions may require manual adjustments.
- What if my migration uses raw SQL instead of Laravel’s Blueprint?
- This package only transforms Blueprint-based migrations. Raw SQL operations will bypass the trait’s logic, so you’ll need to manually adjust those for SQLite compatibility. Focus on using Blueprint where possible for seamless integration.
- How can I test if this package works correctly in my project?
- Start by running migrations in a fresh SQLite database and verifying the schema matches expectations. Use PHPUnit to test migrations in isolation, and add SQLite to your CI/CD pipeline (e.g., GitHub Actions) to catch issues early. Compare the final schema with your production database to ensure consistency.