Giter Site home page Giter Site logo

mysql-keeper's Introduction

MySQL Keeper

Find incorrect configurations or missed optimization opportunities in MySQL databases.

Travis Scrutinizer branch Scrutinizer Packagist Packagist

Installing via Composer

The recommended way to install MySQL Keeper is though Composer.

{
    "require": {
        "zortje/mysql-keeper": "~0.0"
    }
}

Usage

$pdo = new PDO('mysql:host=127.0.0.1;dbname=myapp', 'root', '');

$database = new DatabaseFactory::create($pdo);
$databaseResult = $database->getResult();

$table = new TableFactory::create('users', $pdo);
$tableResult = $table->getResult();

The $databaseResult array will look something like this with the first level keys being table names.

[
	'users' => [
		'issues' => [
			[
				'type' => 'field',
				'field' => 'id',
				'description' => 'Set as auto_increment but has no primary key'
			],
			[
				'type' => 'field',
				'field' => 'id',
				'description' => 'Set as auto_increment but is not set as primary'
			]
		],
		'optimizations' => [
			[
				'type' => 'field',
				'field' => 'id',
				'description' => 'Field should be unsigned, as no field values are negative'
			]
		]
	]
];

The $tableResult array will look something like this.

[
	'issues' => [
		[
			'type' => 'field',
			'field' => 'id',
			'description' => 'Set as auto_increment but is not set as primary'
		],
		[
			'type' => 'field',
			'field' => 'id',
			'description' => 'Set as auto_increment but is not set as primary'
		]
	],
	'optimizations' => [
		[
			'type' => 'field',
			'field' => 'id',
			'description' => 'Field should be unsigned, as no field values are negative'
		]
	]
];

Coming Soon™, how to easily run MySQL Keeper with Melody

Features

Detects the following issues

  • Duplicate indices
  • Missing primary key on auto_increment column
  • Redundant unique index on primary key
  • Redundant key index on primary key
  • Inconsistent usage of collation between table and columns

mysql-keeper's People

Contributors

zortje avatar

Watchers

 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.