47 lines
1.4 KiB
PHP
47 lines
1.4 KiB
PHP
<?php
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
/**
|
|
* Run the migrations.
|
|
*/
|
|
public function up(): void
|
|
{
|
|
DB::statement('ALTER TABLE videos RENAME COLUMN codec TO audio_codec');
|
|
DB::statement('ALTER TABLE videos RENAME COLUMN samplerate TO audio_samplerate');
|
|
DB::statement('ALTER TABLE videos RENAME COLUMN audiochannels TO audio_channels');
|
|
|
|
Schema::table('videos', function (Blueprint $table) {
|
|
$table->string('video_codec')->nullable();
|
|
$table->float('video_framerate')->nullable();
|
|
|
|
$table->dropForeign(['model_id']);
|
|
$table->dropColumn(['identifier','channelmode','model_id']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*/
|
|
public function down(): void
|
|
{
|
|
DB::statement('ALTER TABLE videos RENAME COLUMN audio_codec TO codec');
|
|
DB::statement('ALTER TABLE videos RENAME COLUMN audio_samplerate TO samplerate');
|
|
DB::statement('ALTER TABLE videos RENAME COLUMN audio_channels TO audiochannels');
|
|
|
|
Schema::table('videos', function (Blueprint $table) {
|
|
$table->dropColumn(['video_codec','video_framerate']);
|
|
|
|
$table->string('identifier')->nullable();
|
|
$table->string('channelmode',16)->nullable();
|
|
|
|
$table->bigInteger('model_id')->unsigned()->nullable();
|
|
$table->foreign('model_id')->references('id')->on('models');
|
|
});
|
|
}
|
|
};
|