Make filename unique for each area, rename column to name/lname for files
This commit is contained in:
34
database/migrations/2023_06_23_170537_unique_filenames.php
Normal file
34
database/migrations/2023_06_23_170537_unique_filenames.php
Normal 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()
|
||||
{
|
||||
//
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user