Yii2 Migration Utility ¶
Updated August, 2015
Now supports table indexes, table options for each database type and table data.
This is a utility that writes the create table statement for migrations. The table(s), indexes, foreign keys must already exist.
Supports
- MySQL
- MsSQL
- PgSQL
- SQLite
It automatically writes out all:
- tables
- columns
- column types
- column defaults
- primary keys
- foreign key
- indexes
- Table data
Installation ¶
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-source "c006/yii2-migration-utility" "dev-master"
or add
"c006/yii2-migration-utility": "dev-master"
to the require section of your composer.json
file.
Required ¶
Update either config/web.php (basic) or config/main.php (advanced)
'modules' => [ ... ... ... 'utility' => [ 'class' => 'c006\utility\migration\Module', ], ],
The tables must already exist in website schema.
Demo ¶
Demo: http://demo.c006.us
Usage ¶
http://___[Your_Domain]___</span>/utility ¶
or
http://___[Your_Domain]___</span>/?r=/utility ¶
Updates ¶
- Table options per database type
- Table indexes
- Table data
Comments / Suggestions ¶
Please provide any helpful feedback or requests.
Thanks.
You should see example
Good job, but You should see example in core of Yii
For example, for Your table, table user should :
$this->createTable('{{%user}}', [ 'id' => Schema::TYPE_PK, 'username' => Schema::TYPE_STRING . '(25) NOT NULL', 'email' => Schema::TYPE_STRING . '(255) NOT NULL', 'password_hash' => Schema::TYPE_STRING . '(60) NOT NULL', 'auth_key' => Schema::TYPE_STRING . '(32) NOT NULL', // confirmation 'confirmation_token' => Schema::TYPE_STRING . '(32)', 'confirmation_sent_at' => Schema::TYPE_INTEGER, 'confirmed_at' => Schema::TYPE_INTEGER, 'unconfirmed_email' => Schema::TYPE_STRING . '(255)', // recovery 'recovery_token' => Schema::TYPE_STRING . '(32)', 'recovery_sent_at' => Schema::TYPE_INTEGER, // block 'blocked_at' => Schema::TYPE_INTEGER, // RBAC 'role' => Schema::TYPE_STRING . '(255)', // trackable 'registered_from' => Schema::TYPE_INTEGER, 'logged_in_from' => Schema::TYPE_INTEGER, 'logged_in_at' => Schema::TYPE_INTEGER, // timestamps 'created_at' => Schema::TYPE_INTEGER . ' NOT NULL', 'updated_at' => Schema::TYPE_INTEGER . ' NOT NULL', ], $tableOptions);
Not only think MySQL but globally :)
@ThePr0f3550r
I see your point and will update the code.
Thanks for your input.
New version out v2.x
My apologies for the delay in responding.
New version 2.x is out.
Uncaught ReferenceError: jQuery is not defined
Thank you for this extension!
Only the buttons "add all tables" and "change view" dont work for me, as I get the following error:
~~~
[javascript]
Uncaught ReferenceError: jQuery is not defined
~~~
In my opinion, it is due to the fact that in my template jQuery is called only at line 369:
~~~
[HTML]
~~~
but the extension needs it already in line 279.
Do you have a suggestion, how to solve it?
jQuery is not defined
Hi J-C.
I do this.
yiisoft/yii2/web/JqueryAsset.php
If you have any questions, please ask in the forum instead.
Signup or Login in order to comment.