get(); return Inertia::render('Schemas/Index', [ 'databases' => $databases, ]); } public function show(SourceDatabase $database) { $database->load(['tables.columns', 'tables.indexes', 'tables.foreignKeys']); return Inertia::render('Schemas/Show', [ 'database' => $database, ]); } public function sync(SourceDatabase $database) { try { $this->extractionService->saveSchema($database); return redirect()->back() ->with('success', 'Schema synchronized successfully.'); } catch (\Exception $e) { return redirect()->back() ->with('error', 'Failed to sync schema: ' . $e->getMessage()); } } public function checkChanges(SourceDatabase $database) { $changes = $this->comparisonService->checkForChanges($database); return response()->json([ 'success' => true, 'changes' => $changes, ]); } public function tableDetail(Table $table) { $table->load(['columns', 'indexes', 'foreignKeys', 'sourceDatabase']); return Inertia::render('Schemas/TableDetail', [ 'table' => $table, ]); } public function updateColumn(Request $request, Column $column) { $validated = $request->validate([ 'target_column_name' => 'nullable|string|max:255', 'target_data_type' => 'nullable|string|max:100', 'exclude_from_migration' => 'boolean', ]); $column->update($validated); return redirect()->back() ->with('success', 'Column settings updated successfully.'); } public function pendingChanges() { $changes = $this->comparisonService->getPendingChanges(); return Inertia::render('Schemas/PendingChanges', [ 'changes' => $changes, ]); } public function applyChange(int $changeId) { $this->comparisonService->markAsApplied($changeId); return redirect()->back() ->with('success', 'Schema change marked as applied.'); } }