All Projects → jamband → Yii2 Schemadump

jamband / Yii2 Schemadump

Licence: mit
Generate the schema from an existing database.

Projects that are alternatives of or similar to Yii2 Schemadump

content
Content management system for Yii2
Stars: ✭ 54 (-30.77%)
Mutual labels:  yii2, yii, yii2-extension
Config
Yii2 application runtime configuration support
Stars: ✭ 54 (-30.77%)
Mutual labels:  yii2, yii, yii2-extension
ar-search
Provides unified search model for Yii ActiveRecord
Stars: ✭ 31 (-60.26%)
Mutual labels:  yii2, yii, yii2-extension
Crontab
Yii2 extension for crontab support
Stars: ✭ 170 (+117.95%)
Mutual labels:  yii2, yii, yii2-extension
Sitemap
Site map creation support
Stars: ✭ 59 (-24.36%)
Mutual labels:  yii2, yii, yii2-extension
Ar Softdelete
Soft delete behavior for ActiveRecord
Stars: ✭ 188 (+141.03%)
Mutual labels:  yii2, yii, yii2-extension
yii2-formbuilder
A drag and drop form builder with jQuery for Yii2
Stars: ✭ 33 (-57.69%)
Mutual labels:  yii2, yii, yii2-extension
Ar Position
ActiveRecord behavior, which provides ability for custom records order setup
Stars: ✭ 107 (+37.18%)
Mutual labels:  yii2, yii, yii2-extension
ar-variation
Variation behavior for ActiveRecord
Stars: ✭ 46 (-41.03%)
Mutual labels:  yii2, yii, yii2-extension
yii2-presenter
Yii2 View Presenter
Stars: ✭ 13 (-83.33%)
Mutual labels:  yii2, yii, yii2-extension
Balance
Balance accounting (bookkeeping) system based on debit and credit principle
Stars: ✭ 162 (+107.69%)
Mutual labels:  yii2, yii, yii2-extension
filedb
ActiveRecord for static data definitions based on files
Stars: ✭ 72 (-7.69%)
Mutual labels:  yii2, yii, yii2-extension
Yii2 Assets Auto Compress
Automatic compilation of js + css + html
Stars: ✭ 147 (+88.46%)
Mutual labels:  yii2, yii, yii2-extension
install
basic script for project installation
Stars: ✭ 17 (-78.21%)
Mutual labels:  yii2, yii, yii2-extension
File Storage
File storage abstraction for Yii2
Stars: ✭ 116 (+48.72%)
Mutual labels:  yii2, yii, yii2-extension
behavior-trait
Allows handling events via inline declared methods, which can be added by traits
Stars: ✭ 18 (-76.92%)
Mutual labels:  yii2, yii, yii2-extension
Yii2 Aws S3
An Amazon S3 component for Yii2
Stars: ✭ 86 (+10.26%)
Mutual labels:  yii2, yii, yii2-extension
Admin
Admin pack (actions, widgets, etc) for Yii2
Stars: ✭ 100 (+28.21%)
Mutual labels:  yii2, yii, yii2-extension
ar-role
ActiveRecord behavior, which provides relation roles (table inheritance)
Stars: ✭ 34 (-56.41%)
Mutual labels:  yii2, yii, yii2-extension
ar-dynattribute
Provide ActiveRecord dynamic attributes stored into the single field in serialized state
Stars: ✭ 43 (-44.87%)
Mutual labels:  yii2, yii, yii2-extension

yii2-schemadump

Latest Stable Version Total Downloads Latest Unstable Version License Build Status

Generate the schema from an existing database.

Demo

gif

Installation

composer require --dev --prefer-dist jamband/yii2-schemadump "*"

Usage

Add the following in config/console.php:

return [
    ...
    'components' => [
        ...
    ],
    'controllerMap' => [
        'migrate' => [
            'class' => yii\console\controllers\MigrateController::class,
            'templateFile' => '@jamband/schemadump/template.php',
        ],
        'schemadump' => [
            'class' => jamband\schemadump\SchemaDumpController::class,
            'db' => [
                'class' => yii\db\Connection::class,
                'dsn' => 'mysql:host=localhost;dbname=existing_database_name',
                'username' => 'your_username',
                'password' => 'your_password',
            ],
        ],
    ],
    ...
];

And run schemadump command.

cd /path/to/project
./yii schemadump

Example output:

// user
$this->createTable('{{%user}}', [
    'id' => $this->primaryKey()->comment('主キー'),
    'username' => $this->string(20)->notNull()->unique()->comment('ユーザ名'),
    'email' => $this->string(255)->notNull()->unique()->comemnt('メールアドレス'),
    'password' => $this->string(255)->notNull()->comment('パスワード'),
], $this->tableOptions);

Copy the output code and paste it into a migration file.

Commands

Generates the 'createTable' code. (default)

./yii schemadump
./yii schemadump/create

Generates the 'dropTable' code.

./yii schemadump/drop

Useful commands (for macOS user):

./yii schemadump | pbcopy
./yii schemadump/drop | pbcopy

Check help.

./yii help schemadump

Supports

  • Types
  • Size
  • Unsigned
  • NOT NULL
  • DEFAULT value
  • COMMENT
  • Unique key
  • Foreign key
  • Composite primary keys
  • Primary key without AUTO_INCREMENT
  • ENUM type (for MySQL)
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].