Changes
This commit is contained in:
@@ -11,27 +11,21 @@
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('object_types', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name',50);
|
||||
$table->string('description',125)->nullable();
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('objects', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('reference', 125)->nullable();
|
||||
$table->string('name', 255);
|
||||
$table->string('description', 255)->nullable();
|
||||
// If you keep the column name as 'type_id', specify the table explicitly
|
||||
$table->foreignId('type_id')->constrained('object_types')->nullOnDelete();
|
||||
$table->string('type', 125)->nullable();
|
||||
$table->foreignId('contract_id')->constrained('contracts')->cascadeOnDelete();
|
||||
// Indexes for faster lookups
|
||||
$table->softDeletes();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index('type');
|
||||
$table->index('reference');
|
||||
$table->index('type_id');
|
||||
$table->index('contract_id');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user