2020-06-30 09:27:39 +00:00
|
|
|
<?php
|
2020-07-28 06:34:10 +00:00
|
|
|
//Migrations acts as a version control for the database allowing you to modify the app's database schema
|
2020-06-30 09:27:39 +00:00
|
|
|
|
2020-07-28 06:34:10 +00:00
|
|
|
//allows use of necessary libraries
|
2020-06-30 09:27:39 +00:00
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
2020-07-27 06:24:16 +00:00
|
|
|
class CreateResource extends Migration
|
2020-06-30 09:27:39 +00:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2020-07-27 06:24:16 +00:00
|
|
|
Schema::create('resources', function (Blueprint $table) {
|
2020-06-30 09:27:39 +00:00
|
|
|
$table->id();
|
2020-07-27 06:24:16 +00:00
|
|
|
$table->string("filename")->unique();
|
2020-06-30 09:27:39 +00:00
|
|
|
$table->timestamps();
|
2020-07-27 06:24:16 +00:00
|
|
|
|
2020-08-04 12:11:05 +00:00
|
|
|
$table->foreignid("extension_id")->constrained("resource_extensions", "id");
|
2020-06-30 09:27:39 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
2020-07-27 06:24:16 +00:00
|
|
|
Schema::dropIfExists('resources');
|
2020-06-30 09:27:39 +00:00
|
|
|
}
|
|
|
|
}
|