jjclane/laravel-sqlite-migrations
Composer 安装命令:
composer require jjclane/laravel-sqlite-migrations
包简介
A trait to translate Laravel migrations into SQLite safe migrations.
README 文档
README
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.
Installation
composer require jjclane/laravel-sqlite-migrations --dev
How to use
<?php use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; use JJCLane\SQLiteMigration\TransformMigration; class AddColumnToTable extends Migration { use TransformMigration; /** * Run the migrations. * * @return void */ public function up() { $this->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'); }); } }
统计信息
- 总下载量: 16.58k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-04-09