Skip to content
Advertisement

Laravel 6 – SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax;

when I run

JavaScript

to migrate this Schema

JavaScript

I get this error message

IlluminateDatabaseQueryException : 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 ‘unsigned not null, id_DeviceType varchar(255) unsigned not null, id_DeviceBra' at line 1 (SQL: create tabletransaction_ins(idbigint unsigned not null auto_increment primary key,idTransactionINvarchar(255) not null,buy_datedate not null,id_Suppliervarchar(255) unsigned not null, id_DeviceTypevarchar(255) unsigned not null,id_DeviceBrand varchar(255) unsigned not null,device_namevarchar(255) not null, device_namemediumtext not null,device_pricedecimal(11, 2) not null,amountint not null,sum_pricedecimal(15, 2) not null, contextmediumtext not null,created_attimestamp null, updated_at` timestamp null) default character set utf8mb4 collate ‘utf8mb4_unicode_ci’)

Advertisement

Answer

You can’t have strings unsigned, that’s meant for integers

just remove the unsigned modifier (if they are really strings)

JavaScript

Hope this helps

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement