GithubHelp home page GithubHelp logo

ovidyou / database-table-diff Goto Github PK

View Code? Open in Web Editor NEW
5.0 4.0 5.0 964 KB

A quick way to compare databases from multiple sources (MySQL, PostgreSQL, SQLite) and see differences between table structures.

License: GNU General Public License v3.0

PHP 100.00%

database-table-diff's Introduction

Database Table Diff

A quick way to compare databases from multiple sources (MySQL, PostgreSQL, SQLite) and see differences between table structures.

Current status: compares table names and tables column names.

Features

  • Saves time comparing database table structures
  • Supports MySQL, PostgreSQL, SQLite
  • Cross-comparision between different database engines
  • Easy setup and configuration
  • Compatible with PHP 5.0 and later

Why you might need it

Migrating database schema changes from dev, to test, to production can end up unsuccessfull at times. You need a way to quickly check if there are differences between databases and this is where this tool comes handy.

After migrating a database to a new database engine (e.g. from MySQL to PostgreSQL), you need to ensure that all tables and their respective columns have been successfully migrated.

There are many other scenarios when you would need a quick way to compare databases.

License

This software is licenced under the GPL 3. Please read LICENSE for information on the software availability and distribution.

Setup / Configuration

Before you can use it, you need to ensure you have the proper PDO drivers installed.

Then you can just copy the files under this project into a folder that is accessible to a web server, so you can run it in your browser.

An example configuration can be seen in the provided example.php, or below:

<?php

// Include the class definition
require 'DatabaseTableDiff.php';

// Database configurations
// You can add as many databases as you wish,
// but note that the first one you declare will be compared with all the rest.

$databases['initial_db'] = array(
  'driver' => 'pgsql',
  'host' => 'localhost',
  'port' => '',
  'dbname' => 'my_initial_db',
  'user' => 'root',
  'pass' => 'root',
);

$databases['migrated_db'] = array(
  'driver' => 'mysql',
  'host' => 'localhost',
  'port' => '',
  'dbname' => 'my_migrated_db',
  'user' => 'root',
  'pass' => 'root',
);


// Create a new instance of DatabaseTableDiff.
$DTD = new DatabaseTableDiff($databases);

// Print a html formatted output of the tables differences.
print $DTD->getFormattedTablesDiff();

TODO

  • Add column properties diff for tables
  • Support more database engines

database-table-diff's People

Contributors

ovidyou avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.