Diff for DB
Dbff (mix of db and diff, pronounced like dibiff) โ tool for comparing database structures. Currently available only for MySQL., (*2)
Dbff can compare - databases - tables - columns - indices - data types, (*3)
Obviously, it doesn't cover 100% of MySQL structures. We support only things we need so far. But you can improve this library, you are welcome ;), (*4)
Dbff consists of several decoupled parts: - element โ you can create it, fill it with any values and compare - parser โ converts string presentation of element, taken from 'show create' statement, to array of named values. You can use these values on your own, i.e. for initializing elements or for makink your own diff - builder โ helper for creating elements directly from strings. It takes parsers and other builders as dependencies and use them for building elements - dbffer โ dbff tool itself. It takes two elements and produce some diff in a form of array, (*5)
There are 6 elements - typeprop โ group of properties for some type - type - index - column - table - database, (*6)
We have parser for each element - type parser (for type and typeprop) โ parses type definition from column - index parser โ parses index definition taken from "create table" statement - column parser โ parses column definition taken from "create table" statement - table parser โ parses whole "create table" statement - database parser โ parses "create database" statement, (*7)
Parsers return structs โ arrays with specific keys for each element. See schemas to find out struct keys., (*8)
All parsers have parse
method., (*9)
Parsers return structs that therefore can be used to fill elements. Doing this manually is boring. So builders do it for you. They create elements directly from strings., (*10)
We have builders for each element - type builder - index builder - column builder - table builder - database builder, (*11)
All builders have createFromString
method., (*12)
Complex builders have a lot of dependencies, so for easier creating default builders use DefaultBuilderFactory
., (*13)
Dbffer can compare elements with compareElements
method and compare collections with compareCollections
method., (*14)
This package has no dependencies. Its' components are decoupled. You can use only parsers or you can fill elements manually or you can add your own elements or you can implement your own parsers and still use Dbff., (*15)
Documentation is in development. Please see example.php file provided with this package., (*16)