You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Mar 4, 2025. It is now read-only.
Implement basic checks for schema changes in the diff functions. This
completely ignores table data at the moment and is not very clever with
simple tables changes either.
log.Printf("Couldn't enable extended result codes in dbDiff(): %v\n", err.Error())
93
+
returnDiffs{}, err
94
+
}
95
+
96
+
// Attach the second database
97
+
err=sdb.Exec("ATTACH '"+dbB+"' AS aux")
98
+
iferr!=nil {
99
+
log.Printf("Couldn't attach database in dbDiff(): %s", err)
100
+
returnDiffs{}, err
101
+
}
102
+
103
+
// Get list of all objects in both databases, excluding virtual tables because they tend to be unpredictable
104
+
varstmt*sqlite.Stmt
105
+
stmt, err=sdb.Prepare("SELECT name, type FROM main.sqlite_master WHERE name NOT LIKE 'sqlite_%' AND (type != 'table' OR (type = 'table' AND sql NOT LIKE 'CREATE VIRTUAL%%'))\n"+
106
+
" UNION\n"+
107
+
"SELECT name, type FROM aux.sqlite_master WHERE name NOT LIKE 'sqlite_%' AND (type != 'table' OR (type = 'table' AND sql NOT LIKE 'CREATE VIRTUAL%%'))\n"+
108
+
" ORDER BY name")
109
+
iferr!=nil {
110
+
log.Printf("Error when preparing statement for object list in dbDiff(): %s\n", err)
log.Printf("Error when diffing single object in dbDiff: %s\n", err)
128
+
returnDiffs{}, err
129
+
}
64
130
65
131
// Return
66
132
returndiff, nil
67
133
}
134
+
135
+
// diffSingleObject compares the object with name objectName and of type objectType in the main and aux schemata of the connection sdb
136
+
// and returns three values: a boolean to indicate whether there are differences, a DiffObjectChangeset object containing all the differences, and an optional error object
0 commit comments