about three monthe ago I write a migration to change column type from string to integer which was working fine at that time now it is giving this error
public function up()
{
Schema::table('delivery_zones', function (Blueprint $table) {
$table->Integer('income_rate_zone')->nullable()->change();
$table->Integer('expense_rate_zone')->nullable()->change();
// DB::statement('ALTER TABLE `throttle` MODIFY `user_id` INTEGER UNSIGNED NULL;');
});
}
I can use raw db query but i want to avoid that because i have used this method at many places. i have 2.10 version of doctrine/dbal
Error
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE expen...' at line 1 (SQL: ALTER TABLE delivery_zones CHANGE income_rate_zone income_rate_zone INT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE expense_rate_zone expense_rate_zone INT CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`)
at C:\Projects\temp-xdock\vendor\laravel\framework\src\Illuminate\Database\Connection.php:664
660| // If an exception occurs when attempting to run a query, we'll format the error
661| // message to include the bindings with SQL, which will make this exception a
662| // lot more helpful to the developer instead of just the database's errors.
663| catch (Exception $e) {
> 664| throw new QueryException(
665| $query, $this->prepareBindings($bindings), $e
666| );
667| }
668|
Exception trace:
1 Doctrine\DBAL\Driver\PDOException::("SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'CHARACTER SET utf8mb4 DEFAULT NULL COLLATE `utf8mb4_unicode_ci`, CHANGE expen...' at line 1")
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire