我喜欢将 sqlite 用于 Laravel 4.2 和 artisan 的 CRUD。
php artisan generate:migration create_XXX_table
编辑 app/database/migrations/YYYY_MM_DD_HHMMSS_create_XXX_table.php
<?php
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateKeysTable extends Migration {
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('keys', function(Blueprint $table)
{
$table->increments('id');
$table->text('key_pub');
$table->text('key_private');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('keys', function(Blueprint $table)
{
//
});
}
}
当然,本地和生产环境的配置是 sqlite 驱动程序,使用 'database' => storage_path().'/MYDATABASE.sqlite', MYDATABASE.sqlite 它只是一个通过触摸创建的文件。
也可以尝试,不是文件 MYDATABASE.sqlite 但问题是其他的。
[InvalidArgumentException]
Database does not exist.
在互联网上的各种文章中,展示了这种方法。按惯例创建一个空文件。
但没有任何工作。