Giter VIP home page Giter VIP logo

yii2-migration-utility's People

Contributors

c006 avatar ilyosdev avatar insolita avatar nostop8 avatar sukvojte avatar vitorarantes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

yii2-migration-utility's Issues

addcslashes in insert statements

Hi. I had to change line 166 in DefaultController to

.. addcslashes($row[ $column->name ], "'") ..

because of unneeded slashes before double quotes... (btw. using mysql)

Some JQuery functionalities not working

Hi,
There is a JQuery error:

backend.local/:368 Uncaught ReferenceError: jQuery is not defined

I think this is happening because the hardcoded js code in the view.

Thanks

demo not working

is it only me or the demo link is actually not responding http://demo.c006.us/ , i get the following

The connection has timed out

The server at demo.c006.us is taking too long to respond.

The site could be temporarily unavailable or too busy. Try again in a few moments.
If you are unable to load any pages, check your computer’s network connection.
If your computer or network is protected by a firewall or proxy, make sure that Firefox is permitted to access the Web.

i do not have any firewall installed.

Tool doesn't set default value for integer if it is 0

I have many tables with integer fields, for example:

  • sum (int 11),
  • datetime (int 14, fulled by triggers),
  • deleted (boolean) and other on/off attributes.

All default values in these fileds are set to 0 in DB.

However after migration generation I get such result:

'sum' => 'INT(14) NOT NULL',
'datetime' => 'INT(14) NOT NULL',
'deleted' => 'TYNTINT(1) NOT NULL',

It's wrong. Many of insertings to DB don't work after applying such migration.

To fix it it must be like:

'sum' => 'INT(14) NOT NULL DEFAULT 0',
'datetime' => 'INT(14) NOT NULL DEFAULT 0',
'deleted' => 'TYNTINT(1) NOT NULL DEFAULT 0',

However if default field value differs from 0, all is generating correctly:

'key' => 'INT(11) NOT NULL DEFAULT \'1\'',

Please fix it.

Stable Release

Hi,
Thank you for this extension!

Are you planning to release a stable version soon?

DB prefix in addForeignKey

Then I use table with prefix (tbl),
I get genereted ForeignKey with mistake

$this->addForeignKey(
'fk_tbl_article_tbl_article_lang', 
'{{%tbl_article_lang}}', 'article_id', 
'{{%tbl_article}}', 'id', 
'CASCADE', 'DELETE' 
);
 // need {{%article}} and {{%article_lang}}

not working

Hi,

Was very happy that I found your utility, but it does not work on YII2...

table prefix ignored

suggest
in actionIndex

.....
foreach ($tables as $table) {
                    $columns = \Yii::$app->db->getTableSchema($table);
                    $prefix=\Yii::$app->db->tablePrefix;
                    $table_prepared=str_replace($prefix,'', $table);
                    foreach ($databaseType as $dbType) {
                        if ( $ifThen )
                            $string .= $this->Nw . 'if ($dbType == "' . $dbType . '") {';
                        $string .= $this->Nw . '/* ' . strtoupper($dbType) . ' */';
                        $string .= $this->Nw . '$this->createTable(\'{{%' . $table_prepared . '}}\', [' . $this->Nw;
...

Incorrect enum options escaping and uppercase

I try generate table with enum field, and recieve

$this->createTable('{{%statepusher}}', [
    'id' => 'INT(11) NOT NULL AUTO_INCREMENT',
    'pusher_id' => 'VARCHAR(100) NOT NULL',
    'message' => 'TEXT NOT NULL',
    'type' => 'ENUM('MESS','COUNTER') NOT NULL DEFAULT \'mess\'',
    'created' => 'TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ',
    0 => 'PRIMARY KEY (`id`)'
], $tableOptions);

But expected

'type' => 'ENUM(\'mess\',\'counter\') NOT NULL DEFAULT \'mess\'',

Error if Default column value is CURRENT_TIMESTAMP

(tested with mysql table only)
For fix in AppUtility.php

private function runMySql()
        {
            if ( isset($this->array['dbType']) )
                $this->string .= $this->Tab . "'{$this->array['name']}' => '" . strtoupper($this->array['dbType']) . "";
            if ( isset($this->array['allowNull']) )
                $this->string .= ($this->array['allowNull']) ? ' NULL' : ' NOT NULL';
            if ( isset($this->array['autoIncrement']) )
                $this->string .= ($this->array['autoIncrement']) ? ' AUTO_INCREMENT' : '';
            if ( isset($this->array['defaultValue']) )
                if(!is_array($this->array['defaultValue'])){
                    $this->string .= (empty($this->array['defaultValue'])) ? '' : " DEFAULT \'{$this->array['defaultValue']}\'";
                }else{
                    $this->string .= (empty($this->array['defaultValue'])) ? '' : " DEFAULT ".$this->array['defaultValue']['expression']." ";
                }
        }

validateCsrfToken() issue

I don't know if it is the fault of the new version but I have not used the utility for more than 24 days, today strangely after a clone and composer update, as soon as I point to the url / miaApp / utility I have this return error:

Call to a member function validateCsrfToken() on string

in /var/www/html/motorizzazione/vendor/yiisoft/yii2/web/Controller.php

line 203
Schermata da 2020-07-16 17-52-18

Multiple primary key defined

I had a couple tables with 2 primary keys in my Schema (was using dektrium's yii2-user).

This is the code that generates the error:

 /* MYSQL */
        if (!in_array('auth_assignment', $tables)) {
            if ($dbType == "mysql") {
                $this->createTable('{{%auth_assignment}}', [
                    'item_name' => 'VARCHAR(64) NOT NULL',
                    0 => 'PRIMARY KEY (`item_name`)',
                    'user_id' => 'VARCHAR(64) NOT NULL',
                    1 => 'PRIMARY KEY (`user_id`)',
                    'created_at' => 'INT(11) NULL',
                        ], $tableOptions_mysql);
            }
        }

Solved it by changing it to:

/* MYSQL */
        if (!in_array('auth_assignment', $tables)) {
            if ($dbType == "mysql") {
                $this->createTable('{{%auth_assignment}}', [
                    'item_name' => 'VARCHAR(64) NOT NULL',
                    'user_id' => 'VARCHAR(64) NOT NULL',
                    'created_at' => 'INT(11) NULL',
                        ], $tableOptions_mysql);
                $this->addPrimaryKey(
                                     'auth_assignment_pk',
                                    'auth_assignment',
                                    ['item_name','user_id']
                          );
            }
        }

Other than that, everything worked fine!

Great plugin, thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.