You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
solarai/database/migrations/2022_08_22_100002_create_as...

57 lines
2.3 KiB
PHP

<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateAssetTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('asset', function (Blueprint $table) {
$table->unsignedInteger('id', true)->comment('파일번호');
$table->string('uid', 100)->default('')->comment('파일 UID');
$table->string('orgin_name', 255)->default('')->comment('원본파일명');
$table->string('name', 255)->default('')->comment('업로드 파일명');
$table->string('path', 255)->default('')->comment('서버 파일명');
$table->string('type', 50)->default('')->comment('파일종류');
$table->bigInteger('size')->default(0)->comment('파일용량');
$table->smallInteger('width')->default(0)->comment('이미지 가로사이즈');
$table->smallInteger('height')->default(0)->comment('이미지 세로사이즈');
$table->string('ext', 20)->default('')->comment('파일확장자');
$table->integer('count')->default(0)->comment('다운로드수');
$table->unsignedInteger('created_id')->nullable()->comment('등록 회원번호');
$table->unsignedInteger('updated_id')->nullable()->comment('수정 회원번호');
$table->unsignedInteger('deleted_id')->nullable()->comment('삭제 회원번호');
$table->datetime('created_at')->nullable()->comment('등록일시');
$table->datetime('updated_at')->nullable()->comment('수정일시');
$table->dateTime('deleted_at')->nullable()->comment('삭제일시');
// 인덱스
$table->unique('uid', 'uk_tbl_asset_uid');
$table->index('created_at', 'ik_tbl_asset_created_at');
// 외래키
$table->foreign('created_id', 'fk_tbl_asset_created_id')
->references('id')->on('user')
->onUpdate('cascade')
->onDelete('cascade');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::drop('asset');
}
}