kuvia/database/migrations/2021_01_12_095330_access.php

45 lines
1.2 KiB
PHP
Raw Normal View History

2021-01-12 14:49:45 +00:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class Access extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create("access", function(Blueprint $table) {
$table->id();
$table->timestamp("created_at")->default(\Illuminate\Support\Facades\DB::raw('CURRENT_TIMESTAMP'));
$table->smallInteger("year");
$table->tinyInteger("month");
$table->tinyInteger("day");
$table->tinyInteger("hour");
$table->unsignedBigInteger("image");
$table->unsignedBigInteger("gallery");
$table->unsignedBigInteger("tenant");
$table->enum("typ", ["Access", "Cache"]);
$table->integer("size");
$table->foreign('image')->references('id')->on('images');
$table->foreign('gallery')->references('id')->on('galleries');
$table->foreign('tenant')->references('id')->on('tenants');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists("access");
}
}