Tag

Database

Laravel Database

Resolving Issues with PHPUnit, SQLite, and dropColumn

If you're executing a Laravel migration that involves both dropping and adding columns, this can lead to complications when using SQLite, particularly when coupled with PHPUnit. <?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; return new class extends Migration { public function up(): void { Schema::table('my_table_name', function (Blueprint $table) { $table->dropColumn

Sebastian Widmann

Sebastian Widmann

Webdesigner / Web developer

macOS Database

Locate MySQL Log Files on macOS

If you are using macOS, you can use the following SQL statements to find your MySQL logs: SHOW VARIABLES LIKE '%general_log%'; SHOW VARIABLES LIKE '%slow_query_log%'; The output should look something like this: general_log ON general_log_file /usr/local/mysql/data/localhost.log slow_query_log ON slow_query_log_file /usr/local/mysql/data/localhost-slow.log Now, you can use tail to display the latest 100 entries, for example: tail -f -n 100 /usr/local/mysql/data/local

Sebastian Widmann

Sebastian Widmann

Webdesigner / Web developer

Database

Get MySQL Version

MySQL is a popular open-source relational database management system used by countless developers and organizations worldwide. Whether you're a beginner or an experienced user, there might come a time when you need to determine the version of your MySQL server. Thankfully, MySQL provides a simple and efficient way to obtain this information using a straightforward SQL statement. To retrieve the version of your MySQL server, all you need is the following SQL query: SELECT VERSION(); Executing th

Sebastian Widmann

Sebastian Widmann

Webdesigner / Web developer