dmstr/yii2-db Database extensions

extensiondatabasedb

Yii 2 Database Toolkit

Latest Stable Version Total Downloads License

About

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist dmstr/yii2-db "*"

or add

"dmstr/yii2-db": "*"

to the require section of your composer.json file.

Commands

yii db

DESCRIPTION

MySQL database maintenance command.

SUB-COMMANDS

- db/create               Create MySQL database
- db/destroy              Remove the current schema
- db/dump                 Dumps current database tables to runtime folder
- db/export               export data tables, without logs and caches
- db/import
- db/index (default)      Displays tables in database
- db/wait-for-connection

To see the detailed information about individual sub-commands, enter:

  yii help <sub-command>

Usage

dmstr\db\behaviors\HydratedAttributes

Retrieves all eager loaded attributes of a model including relations. Once the extension is installed, simply use it in your code by accessing the corresponding classes by their full namespaced path.

dmstr\db\mysql\FileMigration

runs database migrations from sql files

Create a file migration class

./yii migrate/create \
    --templateFile='@vendor/dmstr/yii2-db/db/mysql/templates/file-migration.php' init_dump

dmstr\console\controllers

Include it in your console configuration

   'controllerMap' => [
        'db'         => [
            'class' => 'dmstr\console\controllers\MysqlController',
            'noDataTables' => [
                'app_log',
                'app_session',
            ]
        ],
    ],

Show help

./yii help db

Available commands

DESCRIPTION

MySQL database maintenance command.

SUB-COMMANDS

- db/create           Create MySQL database from ENV vars and grant permissions
- db/dump             Dumps current database tables to runtime folder
- db/index (default)  Displays tables in database

Built by dmstr

Statistics

Downloads
GitHub Stars
GitHub Forks

Releases

Comments



2.0.0-rc2 is the latest of 68 releases



BSD-3-Clause license
Stats
17 github stars & 11 github forks
120 downloads in the last day
2546 downloads in the last 30 days
144783 total downloads