PHP Classes

What is the best PHP database schema abstraction class?: Applications Database Schema

Recommend this page to a friend!
  All requests RSS feed  >  What is the best PHP database schema ...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

What is the best PHP database schema abstraction class?


by Till Wehowski - 3 years ago (2015-08-07)

Applications Database Schema

This request is clear and relevant.
This request is not clear or is not relevant.


I wish to be able to change the applications database schema at a later point easily.

So I need to version the tables structures (table names, field names, keys, etc.).

And convert DBs between versions.

Any sugestions for existing solutions?

I do NOT need a class to execute queries.

Ask clarification

1 Recommendation

Metabase: PHP Database abstraction layer RDBMS independent

This recommendation solves the problem.
This recommendation does not solve the problem.


by Samuel Adeshina Reputation 825 - 3 years ago (2015-08-07) Comment

This class does exactly what you need. check here: for more info

  • 1. by Manuel Lemos package author package author - 3 years ago (2015-08-07) Reply

    Well the Metabase package was created with to be a database abstraction layer that supports also schema management.

    You can define the database schema of tables, fields, keys, indexes, etc.. in a XML format file.

    Then you tell the schema manager to install that schema.

    If you want to update the schema, just change the XML schema file and tell the schema manager to update the database performing the necessary changes.

    This way you add your application schema file to your project repository, so you can have it versioned too like any other file in the project.

    I have been using things for many years and it enabled great productivity and low risk of screwing up your database performing part of the changes when you request changes not supported by the underlying database.

    As for a class that does not execute queries, this is tricky. The problem is that Metabase abstracts the table creation and alteration processes. So the resulting SQL queries will be different depending on the database.

    I don't know why you do not want to execute the schema changes, but want can be done is to improve Metabase to log queries instead of executing them.

  • 2. by Till Wehowski - 3 years ago (2015-08-07) in reply to comment 1 by Manuel Lemos Reply

    Well, it maybe CAN execute queries, but I just use PDO and other classes for this task. As for you said required queries are driver dependent I will try this class, thank you! It looks like it provides exactly what I need.

  • 3. by Manuel Lemos package author package author - 3 years ago (2015-08-07) in reply to comment 2 by Till Wehowski Reply

    Yes, PDO did not exist when this package was created. Still PDO does not provide all the portability you need.

    It would be possible to add a PDO driver to this package but then it would require also sub-drivers for each other database.

    This was done a long time ago with ODBC because it was the only was to access Microsoft Access databases but it is a lot more work.

Recommend package