I've had to change a table in my database so that the primary key isn't the standard increments.
Here's the migration,
public function up()
{
    Schema::create('settings', function (Blueprint $table) {
        $table->text('code', 30)->primary();
        $table->timestamps();
        $table->text('name');
        $table->text('comment');
    });
}
However, MySQL keeps returning with,
Syntax error or access violation: 1170 BLOB/TEXT column 'code' used in key specification without a key length (SQL: alter table
settingsadd primary keysettings_code_primary(code)
I've tried leaving the normal increments id in there and modifying the table in a different migration but the same thing happens.
Any ideas of what I'm doing wrong?
Laveral Version 5.4.23
Change it to string.
$table->string('code', 30)->primary(); 
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With