made all sqlite fields nullable to fix various problems with the difference in sqlite's null functionality #393
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
DB Driver: SQLITE
// migration up
Schema::table('users', function($table)
{
$table->string('first_name');
$table->string('last_name');
});
$ php artisan migrate
SQLSTATE[HY000]: General error: 1 Cannot add a NOT NULL column with default value NULL
SQL: ALTER TABLE "users" ADD COLUMN "first_name" VARCHAR NOT NULL
Bindings: array ()
// controller code
$user = new User;
$user->fill(array(
'email' => 'bob@bob.com',
'username' => 'cat'
));
$user->save();
// web error
Unhandled Exception
Message:
SQLSTATE[23000]: Integrity constraint violation: 19 users.real_name may not be NULL
SQL: INSERT INTO "users" ("email", "username", "updated_at", "created_at") VALUES (?, ?, ?, ?)
Bindings: array (
0 => 'bob@bob.com',
1 => 'cat',
2 => '2012-03-07 19:37:34',
3 => '2012-03-07 19:37:34',
)
Location:
D:\web\new-street-works\laravel\database\connection.php on line 200
Stack Trace:
#0 D:\web\new-street-works\laravel\database\connection.php(141): Laravel\Database\Connection->execute('INSERT INTO "us...', Array)
#1 D:\web\new-street-works\laravel\database\query.php(736): Laravel\Database\Connection->query('INSERT INTO "us...', Array)
#2 D:\web\new-street-works\bundles\eloquent\model.php(437): Laravel\Database\Query->insert_get_id(Array, NULL)
#3 D:\web\new-street-works\bundles\auth\models\user.php(48): Eloquent\Model->save()
#4 D:\web\new-street-works\application\controllers\home.php(17): User->save()
#5 [internal function]: Home_Controller->action_index()
#6 D:\web\new-street-works\laravel\routing\controller.php(241): call_user_func_array(Array, Array)
#7 D:\web\new-street-works\laravel\routing\controller.php(201): Laravel\Routing\Controller->response('index', Array)
#8 D:\web\new-street-works\laravel\routing\controller.php(80): Laravel\Routing\Controller->execute('index', Array)
#9 D:\web\new-street-works\laravel\routing\route.php(139): Laravel\Routing\Controller::call('home@index', Array)
#10 D:\web\new-street-works\laravel\routing\route.php(110): Laravel\Routing\Route->response()
#11 D:\web\new-street-works\laravel\laravel.php(173): Laravel\Routing\Route->call()
#12 D:\web\new-street-works\public\index.php(52): require('D:\web\new-stre...')
#13 {main}