43 lines
1.1 KiB
PHP
43 lines
1.1 KiB
PHP
<?php
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
try {
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=0;');
|
|
|
|
// 1. Approvals
|
|
DB::table('approval_steps')->truncate();
|
|
DB::table('approval_chains')->truncate();
|
|
|
|
// 2. Inventory Movements
|
|
DB::table('inventory_movements')->truncate();
|
|
|
|
// 3. Purchase Orders and MRs
|
|
DB::table('purchase_order_items')->truncate();
|
|
DB::table('purchase_order_requisitions')->truncate();
|
|
DB::table('purchase_orders')->truncate();
|
|
|
|
DB::table('material_requisition_items')->truncate();
|
|
DB::table('material_requisitions')->truncate();
|
|
|
|
// 4. Inventory
|
|
DB::table('warehouse_stock')->truncate();
|
|
DB::table('project_inventories')->truncate();
|
|
DB::table('inventory_batches')->truncate();
|
|
DB::table('task_materials')->truncate();
|
|
|
|
// 5. Warehouses
|
|
DB::table('warehouses')->truncate();
|
|
|
|
// 6. Projects and Tasks
|
|
DB::table('task_user')->truncate();
|
|
DB::table('tasks')->truncate();
|
|
DB::table('projects')->truncate();
|
|
|
|
DB::statement('SET FOREIGN_KEY_CHECKS=1;');
|
|
|
|
echo "Data cleared successfully!\n";
|
|
} catch (\Exception $e) {
|
|
echo "Error: " . $e->getMessage() . "\n";
|
|
}
|