Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MediumBlob in Laravel database schema

Tags:

People also ask

What is database schema in laravel?

The Laravel Schema class provides a database agnostic way of manipulating tables. It works well with all of the databases supported by Laravel, and has a unified API across all of these systems.

What is foreign key in laravel?

A foreign key is a field that is used to establish the relationship between two tables via the primary key (You can also use a non-primary field but not recommended). In this tutorial, I show how you can add a foreign key constraint while creating a table using migration in the Laravel 8 project.

Where is database configuration in laravel?

The configuration for Laravel's database services is located in your application's config/database. php configuration file. In this file, you may define all of your database connections, as well as specify which connection should be used by default.

Which database is used with laravel?

Currently Laravel supports four database systems: MySQL, Postgres, SQLite, and SQL Server.


How can I create a Mediumblob within the Laravel schema builder ?

In the docs it says :

$table->binary('data'); // BLOB equivalent to the table

But I need a MediumBlob otherwise the images get truncated at 64K; we are running MySQL.

I know that Laravel's schema builder is DB agnostic, but is there a way to avoid the "native way" and if not how can i create a Mediumblob column ?