Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Laravel Sqlite Migrations

Laravel Sqlite Migrations Laravel Package

jjclane/laravel-sqlite-migrations

Trait for Laravel migrations that makes schema changes SQLite-safe. Automatically transforms unsupported column types and avoids “Cannot add a NOT NULL column with default value NULL” by adding columns safely, letting migrations run cleanly on SQLite.

View on GitHub
Deep Wiki
Context7

A trait to translate Laravel migrations into SQLite safe migrations.

Frequently asked questions about Laravel Sqlite Migrations
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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
jayeshmepani/jpl-moshier-ephemeris-php
elnasnato/laraliveui
labrodev/rest-sdk
sampaui/sampaui
babelqueue/php-sdk
facebook/capi-param-builder-php
babelqueue/symfony
hamzi/corewatch
minionfactory/raw-hydrator
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle