mirror of
https://github.com/Poniverse/Pony.fm.git
synced 2024-11-26 23:07:59 +01:00
25 lines
731 B
PHP
25 lines
731 B
PHP
|
<?php
|
||
|
|
||
|
use Illuminate\Database\Migrations\Migration;
|
||
|
|
||
|
class CreateFollowers extends Migration {
|
||
|
public function up() {
|
||
|
Schema::create('followers', function($table){
|
||
|
$table->increments('id');
|
||
|
$table->integer('user_id')->unsigned()->index();
|
||
|
|
||
|
$table->integer('artist_id')->unsigned()->nullable()->index();
|
||
|
$table->integer('playlist_id')->unsigned()->nullable()->index();
|
||
|
|
||
|
$table->timestamp('created_at');
|
||
|
|
||
|
$table->foreign('user_id')->references('id')->on('users')->on_delete('cascade');
|
||
|
$table->foreign('artist_id')->references('id')->on('users')->on_delete('cascade');
|
||
|
$table->foreign('playlist_id')->references('id')->on('playlists');
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public function down() {
|
||
|
Schema::drop('followers');
|
||
|
}
|
||
|
}
|