This function will compare the two schema.
(params)
| 639 | @socketio.on('compare_schema', namespace=SOCKETIO_NAMESPACE) |
| 640 | @socket_login_required |
| 641 | def compare_schema(params): |
| 642 | """ |
| 643 | This function will compare the two schema. |
| 644 | """ |
| 645 | # Check the pre validation before compare |
| 646 | SchemaDiffRegistry.set_schema_diff_compare_mode(SCH_OBJ_STR) |
| 647 | status, error_msg, diff_model_obj, session_obj = \ |
| 648 | compare_pre_validation(params['trans_id'], params['source_sid'], |
| 649 | params['target_sid']) |
| 650 | if not status: |
| 651 | socketio.emit('compare_schema_failed', |
| 652 | error_msg.json if isinstance( |
| 653 | error_msg, Response) else error_msg, |
| 654 | namespace=SOCKETIO_NAMESPACE, to=request.sid) |
| 655 | return error_msg |
| 656 | |
| 657 | comparison_result = [] |
| 658 | |
| 659 | update_session_diff_transaction(params['trans_id'], session_obj, |
| 660 | diff_model_obj) |
| 661 | try: |
| 662 | ignore_owner = bool(params['ignore_owner']) |
| 663 | ignore_whitespaces = bool(params['ignore_whitespaces']) |
| 664 | ignore_tablespace = bool(params['ignore_tablespace']) |
| 665 | ignore_grants = bool(params['ignore_grants']) |
| 666 | all_registered_nodes = SchemaDiffRegistry.get_registered_nodes() |
| 667 | node_percent = round(100 / len(all_registered_nodes), 2) |
| 668 | total_percent = 0 |
| 669 | |
| 670 | comparison_schema_result, total_percent = \ |
| 671 | compare_schema_objects( |
| 672 | trans_id=params['trans_id'], session_obj=session_obj, |
| 673 | source_sid=params['source_sid'], |
| 674 | source_did=params['source_did'], |
| 675 | source_scid=params['source_scid'], |
| 676 | target_sid=params['target_sid'], |
| 677 | target_did=params['target_did'], |
| 678 | target_scid=params['target_scid'], |
| 679 | schema_name=gettext(SCH_OBJ_STR), |
| 680 | diff_model_obj=diff_model_obj, |
| 681 | total_percent=total_percent, |
| 682 | node_percent=node_percent, |
| 683 | ignore_owner=ignore_owner, |
| 684 | ignore_whitespaces=ignore_whitespaces, |
| 685 | ignore_tablespace=ignore_tablespace, |
| 686 | ignore_grants=ignore_grants) |
| 687 | |
| 688 | comparison_result = \ |
| 689 | comparison_result + comparison_schema_result |
| 690 | |
| 691 | # Update the message and total percentage done in session object |
| 692 | update_session_diff_transaction(params['trans_id'], session_obj, |
| 693 | diff_model_obj) |
| 694 | |
| 695 | except Exception as e: |
| 696 | app.logger.exception(e) |
| 697 | socketio.emit('compare_schema_failed', str(e), |
| 698 | namespace=SOCKETIO_NAMESPACE, to=request.sid) |
nothing calls this directly
no test coverage detected