PHPackages                             raul338/cakephp-schema - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. raul338/cakephp-schema

ActiveCakephp-plugin[Database &amp; ORM](/categories/database)

raul338/cakephp-schema
======================

Schema saving and loading from file for CakePHP 4

3.1.3(5y ago)05.3kMITPHPPHP &gt;=7.2

Since Oct 7Pushed 5y ago1 watchersCompare

[ Source](https://github.com/raul338/cakephp-schema)[ Packagist](https://packagist.org/packages/raul338/cakephp-schema)[ Docs](https://github.com/raul338/cakephp-schema)[ RSS](/packages/raul338-cakephp-schema/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (10)Dependencies (10)Versions (23)Used By (0)

Schema plugin for CakePHP 4.x
=============================

[](#schema-plugin-for-cakephp-4x)

[![CI](https://github.com/raul338/cakephp-schema/actions/workflows/ci.yml/badge.svg)](https://github.com/raul338/cakephp-schema/actions/workflows/ci.yml) [![codecov](https://camo.githubusercontent.com/f910d77b26dc1f40be37674614ea23e3b33d5d601f3ab45905fda19f41de7075/68747470733a2f2f636f6465636f762e696f2f67682f7261756c3333382f63616b657068702d736368656d612f6272616e63682f6d61737465722f67726170682f62616467652e7376673f746f6b656e3d464f4c5a435937565349)](https://codecov.io/gh/raul338/cakephp-schema)

for usage in CakePHP 3.x see the [2.x branch](https://github.com/raul338/cakephp-schema/tree/2.x)

Save the schema into one file and use as an automatic schema for Fixtures. The schema is automatically saved when executing `cake migrations migrate`. This also allows for local testing with test suite data for debugging.

Supported datasources
---------------------

[](#supported-datasources)

- Postgres
- MySQL
- SQLite
- SQL Server not tested yet

Installation
------------

[](#installation)

You can install this plugin into your CakePHP application using [composer](http://getcomposer.org).

The recommended way to install composer packages is:

```
composer require raul338/cakephp-schema

```

Update your `Application` class:

```
public function bootstrapCli()
{
    // ....
    $this->addOptionalPlugin('Schema');
}
```

Usage
-----

[](#usage)

The plugin saves the schema of the `default` connection to the `config/schema.php` file. The structure is similar to the fixtures fields.

```
cake schema save

```

To load the schema back, useful for debug with test data. Run:

```
cake schema load

```

### Seed

[](#seed)

The Schema plugin allows you to seed data from the `config/seed.php` file. This also is useful to save unrelated tables (like tables from acl plugin, or `sphinxlog` table) The `seed.php` file should return array of tables and rows:

```
