Is there a way to automate the reverse engineer feature?
I have to manually do this every time we have a new release.
Thanks in advance.
The trick to doing this is to create a batch file with a job agent in Windows. in that batch file, you'll need to run ERS from the command line, using a parameter to specify a Macro inside ERS to do the reverse engineering. There's a doc file here that can help, but I don't know if it's up to date.
The challenge is that there can be nothing else happening on the machine, otherwise it can interfere with the execution of the Macro.
I should do this and blog about it :).
Is there a sample macro to reverse engineer a schema and generate the ERD reports?
You will need to create a Quick Launch file first, then you can alter the entries in the below sample macro:
' compare and mergeConst IGNORE As Integer = 0Const MERGE_ALL_TO_TARGET As Integer = 1Const MERGE_ALL_TO_CURRENT As Integer = 2Const FILE_PATH = "C:\temp\CM\"Option Explicit
Dim theDiagram As Diagram Dim theModel As Model
Sub Main Debug.Clear Dim fileName As String Dim DataModelFileName As String Dim QuickLaunchFileName As String Dim ComparisonReportFileName As String
On Error GoTo errHandler
QuickLaunchFileName = FILE_PATH & "compare.cmo" ComparisonReportFileName = FILE_PATH & "diff.rtf"
Set theDiagram = DiagramManager.ActiveDiagram CheckOp()
MsgBox Err.DescriptionEnd Sub
Private Sub doCompare(QuickLaunchFileName As String, ComparisonReportFileName As String, Decision As Integer) Dim theMergeObj As MergeModel Set theModel = theDiagram.ActiveModel Set theMergeObj = theDiagram.MergeModelObject theMergeObj.MergeReport(QuickLaunchFileName, ComparisonReportFileName,1, 0) theMergeObj.DoMerge(QuickLaunchFileName,Decision)End Sub
Function CheckOp(Optional opRetVal As Variant = Nothing) Dim errorCode As Integer
errorCode = DiagramManager.GetLastErrorCode() If (errorCode <> 0) Then Err.Raise Number := vbObjectError + errorCode, _ Source := "Macro error handler", _ Description := DiagramManager.GetLastErrorString() End IfEnd Function
Powered by IDERA