Pony.fm/database/migrations/2013_08_29_025516_create_followers.php

25 lines
731 B
PHP
Raw Normal View History

2015-08-30 14:29:12 +02:00
<?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');
}
}