40 lines
890 B
PHP
40 lines
890 B
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Support\Facades\Schema;
|
||
|
use Illuminate\Database\Schema\Blueprint;
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
|
||
|
class AddAlbumActivityColumn extends Migration
|
||
|
{
|
||
|
/**
|
||
|
* Run the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function up()
|
||
|
{
|
||
|
Schema::table('user_activity', function (Blueprint $table)
|
||
|
{
|
||
|
$table->unsignedInteger('album_id')->nullable(true);
|
||
|
|
||
|
$table->foreign('album_id')
|
||
|
->references('id')->on('albums')
|
||
|
->onDelete('cascade');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Reverse the migrations.
|
||
|
*
|
||
|
* @return void
|
||
|
*/
|
||
|
public function down()
|
||
|
{
|
||
|
Schema::table('user_activity', function (Blueprint $table)
|
||
|
{
|
||
|
$table->dropForeign('user_activity_album_id_foreign');
|
||
|
$table->dropColumn('album_id');
|
||
|
});
|
||
|
}
|
||
|
}
|