Differential D4142 Diff 12038 src/database/migrations/2022_03_02_100000_create_filesystem_tables.php
Changeset View
Changeset View
Standalone View
Standalone View
src/database/migrations/2022_03_02_100000_create_filesystem_tables.php
Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | public function up(): void | ||||
$table->unique(['item_id', 'chunk_id']); | $table->unique(['item_id', 'chunk_id']); | ||||
// $table->unique(['item_id', 'sequence', 'deleted_at']); | // $table->unique(['item_id', 'sequence', 'deleted_at']); | ||||
$table->foreign('item_id')->references('id')->on('fs_items') | $table->foreign('item_id')->references('id')->on('fs_items') | ||||
->onUpdate('cascade')->onDelete('cascade'); | ->onUpdate('cascade')->onDelete('cascade'); | ||||
} | } | ||||
); | ); | ||||
if (\config('app.with_files') && !\App\Sku::where('title', 'files')->first()) { | |||||
\App\Sku::create([ | |||||
'title' => 'files', | |||||
'name' => 'File storage', | |||||
'description' => 'Access to file storage', | |||||
'cost' => 0, | |||||
'units_free' => 0, | |||||
'period' => 'monthly', | |||||
'handler_class' => 'App\Handlers\Files', | |||||
'active' => true, | |||||
]); | |||||
} | |||||
} | } | ||||
/** | /** | ||||
* Reverse the migrations. | * Reverse the migrations. | ||||
*/ | */ | ||||
public function down(): void | public function down(): void | ||||
{ | { | ||||
\App\Sku::where('title', 'files')->delete(); | |||||
Schema::dropIfExists('fs_properties'); | Schema::dropIfExists('fs_properties'); | ||||
Schema::dropIfExists('fs_chunks'); | Schema::dropIfExists('fs_chunks'); | ||||
Schema::dropIfExists('fs_items'); | Schema::dropIfExists('fs_items'); | ||||
} | } | ||||
}; | }; |