Make filename unique for each area, rename column to name/lname for files

This commit is contained in:
2023-06-23 17:33:47 +10:00
parent 0eca20ebdd
commit b8534d8598
4 changed files with 42 additions and 8 deletions

View File

@@ -0,0 +1,34 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
// delete from files where id in (130,110,25,49,50,51,52,53,73,105,4,44,60,83,85,63,88,90,66,68,70,72,75,78,80,123,124,127,1,102,104,107,109,113,115,117,2,119)
public function up()
{
DB::statement('ALTER TABLE files RENAME COLUMN file to name');
DB::statement('ALTER TABLE files RENAME COLUMN lfile to lname');
Schema::table('files',function (Blueprint $table) {
$table->unique(['filearea_id','name']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
}
};