https://github.com/jjclane/laravel-sqlite-migrations
A trait to translate Laravel migrations into SQLite safe migrations.
https://github.com/jjclane/laravel-sqlite-migrations
illuminate-database laravel laravel-5-package migrations sqlite
Last synced: 9 days ago
JSON representation
A trait to translate Laravel migrations into SQLite safe migrations.
- Host: GitHub
- URL: https://github.com/jjclane/laravel-sqlite-migrations
- Owner: JJCLane
- Created: 2018-04-08T23:51:08.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T15:16:08.000Z (almost 2 years ago)
- Last Synced: 2026-01-14T14:43:40.408Z (10 days ago)
- Topics: illuminate-database, laravel, laravel-5-package, migrations, sqlite
- Language: PHP
- Homepage:
- Size: 8.79 KB
- Stars: 14
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel SQLite Migrations
A trait to translate Laravel migrations into SQLite safe migrations.
This avoids the `Cannot add a NOT NULL column with default value NULL` issue that you receive when trying to add a non-nullable column to
an existing table in a migration by initially adding the column as nullable and then modifying the column in a separate migration.
It also maps Laravel datatypes that aren't supported in SQLite to avoid [this](https://github.com/laravel/framework/issues/8840).
## Installation
`composer require jjclane/laravel-sqlite-migrations --dev`
## How to use
````php
table('table', function (Blueprint $table) {
// Normal migrations
$table->decimal('my_col', 10, 1)->unsigned()->after('my_other_col');
});
// or if you prefer to be more explicit
$this->transformMigration('table', function (Blueprint $table) {
// Normal migrations
$table->decimal('my_col', 10, 1)->unsigned()->after('my_other_col');
});
}
}
````