2017 © Pedro Peláez
 

library mysql-keeper

Find incorrect configurations or missed optimization opportunities in MySQL databases

image

zortje/mysql-keeper

Find incorrect configurations or missed optimization opportunities in MySQL databases

  • Thursday, July 14, 2016
  • by Zortje
  • Repository
  • 3 Watchers
  • 5 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 6 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

MySQL Keeper

Find incorrect configurations or missed optimization opportunities in MySQL databases., (*1)

Packagist Travis branch Scrutinizer branch Scrutinizer Dependency Status Packagist, (*2)

SensioLabsInsight, (*3)

Features

Detects the following issues, (*4)

  • 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

Installing via Composer

The recommended way to install MySQL Keeper is though Composer., (*5)

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

Usage

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

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

The $databaseResult array will look something like this with the first level keys being table names., (*6)

[
    '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'
            ]
        ]
    ]
];

Usage with Melody

Melody allows inline Composer requirements to simply execute PHP scripts., (*7)

mysql-keeper_myapp.php, (*8)

<?php

<<<CONFIG
packages:
    - "zortje/mysql-keeper": "~0.0"
CONFIG;

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

$database = Zortje\MySQLKeeper\DatabaseFactory::create($pdo);

print_r($database->getResult());

Simply run:, (*9)

$ melody run mysql-keeper_myapp.php

The Versions

14/07 2016

dev-master

9999999-dev

Find incorrect configurations or missed optimization opportunities in MySQL databases

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-pdo >=1.0
  • ext-pdo_mysql >=1.0

 

The Development Requires

mysql optimization

06/06 2015

dev-fix/test-coverage

dev-fix/test-coverage

Find incorrect configurations or missed optimization opportunities in MySQL databases

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-pdo ~1.0
  • ext-pdo_mysql ~1.0

 

The Development Requires

mysql optimization

22/02 2015

0.4.0

0.4.0.0

Find incorrect configurations or missed optimization opportunities in MySQL databases

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-pdo ~1.0
  • ext-pdo_mysql ~1.0

 

The Development Requires

mysql optimization

19/01 2015

0.3.0

0.3.0.0

Find incorrect configurations or missed optimization opportunities in MySQL databases

  Sources   Download

MIT

The Requires

  • php >=5.4
  • ext-pdo ~1.0
  • ext-pdo_mysql ~1.0

 

The Development Requires

mysql optimization

18/01 2015

0.2.0

0.2.0.0

Find incorrect configurations or missed optimization opportunities in MySQL databases

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

mysql optimization

17/01 2015

0.1.0

0.1.0.0

Find incorrect configurations or missed optimization opportunities in MySQL databases

  Sources   Download

MIT

The Requires

  • php >=5.4

 

The Development Requires

mysql optimization