Skip to content

dm diff --mysql #85

@lukemarsden

Description

@lukemarsden

dm diff --mysql should show me the SQL needed to transform. This would help me write an acceptance test!

User story: As a developer, I want to use the state I’ve captured between two datamesh commits to figure out how to manually write a test that reproduces the problem so that I can have self-contained tests because that’s obviously best practice


alaric [9:43 AM]
That would be nice, but would require significant machinery to implement

[9:44]
Such machineries could, perhaps, be built as separate containers that get fetched on demand, so everyone's not burdened with downloading mysql/psql/mongodb/... delta tools

luke [9:45 AM]
yes!

[9:45]
and they probably exist already

alaric [9:45 AM]
has seen tools to do it for MySQL, certainly

luke
[9:46]
seeing the SQL delta clearly could turn it from “here’s a black box binary blob” to “oh!”

alaric
[9:49 AM]
Yeah. And we heard people say "snapshots of the DB are just binary blobs, what use is that?", which is a misconception, but this will help to dispell it.

luke [9:49 AM]
yes!

[9:49]
🙂

alaric [9:49 AM]
wonders how we'd implement it

alaric
[9:49 AM]
Given two MySQL db snapshots

[9:50]
Fire up a container that mounts both of them in /a and /b, and runs two mysqlds configured to skip grant tables so we don't care what the auth setup is in the dbs

[9:50]
Enumerate the databases on each mysqldb, and for ones that exist in only one, just note their existence (and mysqldump the entire thing for a new db?); for the ones that exist in both, fire up a mysqldiff tool and output the diffs

[9:51]
Glom all the results together with suitable CREATE/DROP DATABASE commands for the added/removed DBs, and you've got a mysql diff of two servers

luke
[9:51 AM]
yep

[9:51]
i’m certain there are tools that can do this already just given two mysql dbs

[9:51]
i.e. database servers

alaric [9:52 AM]
There are tools that do this for two MySQL connection strings, that I've seen

alaric
[9:52 AM]
So they need the servers up and running with known hostnames and ports and user details, and specific database names on those servers, AFAICT

[9:53]
We'd use a tool like that to do the delta when the same db name exists on both, but I think we'll need to write our own outer loop to iterate over DBs, as I've not seen that done before; but it'll be easy

[9:53]
Most of the ones I've found by googling just do schema changes, darnit; I'm sure there's a tool they use at Volo that does data changes too

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions