Giter Site home page Giter Site logo

Comments (7)

bizley avatar bizley commented on May 28, 2024 1

I'm guessing that one of your existing migrations contains the instruction to insert data into the database, and you are not using the insert or execute action to do that - is it the case?

If so, the only thing I can suggest is to put that migration on the skipMigrations list so it can be skipped on the extraction step. Or you can update the instruction to use insert or execute - my package will ignore it then.

If this is not the case let me know, you might stumble upon some error that I need to fix.

from yii2-migration.

bizley avatar bizley commented on May 28, 2024 1

Yes, please. I'm closing this one.

from yii2-migration.

bizley avatar bizley commented on May 28, 2024

Closing since there is no response. Please comment here if you want to continue with that issue.

from yii2-migration.

optmsp avatar optmsp commented on May 28, 2024

Hi there, sorry for delay. You are correct, I am not using insert or execute in the migration generating the error. I went through and excluded all of my data init migrations using --skip-migrations and it began working.

from yii2-migration.

optmsp avatar optmsp commented on May 28, 2024

Okay, I now have a new problem and haven't quite figured it out. So I've noticed that most of my tables generator this error:

 > Comparing current table 'rtm_auth_assignment' with its migrations ...DONE!
 > Comparing current table 'rtm_auth_item' with its migrations ...TABLE IS UP-TO-DATE.
 > Comparing current table 'rtm_auth_item_child' with its migrations ...DONE!
 > Comparing current table 'rtm_auth_rule' with its migrations ...TABLE IS UP-TO-DATE.
 > Comparing current table 'rtm_category' with its migrations ...ERROR!
 > Column data must be provided as an instance of yii\db\ColumnSchemaBuilder. Do you have column configuration provided as a string while not using experimental mode (--ex)?

I'm unclear of what I am doing wrong in my original migration? I am simply extending yii\db\Migration. I am relatively new to yii (I'm using yii2), so it's possible I simply did something the non-yii way? Here is the migration:

<?php

use yii\db\Migration;

class m210814_125114_012_create_table_rtm_category extends Migration
{
    public function up()
    {
        $tableOptions = null;
        if ($this->db->driverName === 'mysql') {
            $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB';
        }

        $this->createTable(
            '{{%category}}',
            [
                'id' => $this->primaryKey(),
                'uuid' => $this->string(36),
                'oplock' => $this->integer()->defaultValue('0')->notNull(),
                'user_id' => $this->integer()->notNull(),
                'created_at' => $this->dateTime()->defaultExpression('CURRENT_TIMESTAMP'),
                'updated_at' => $this->dateTime(),
                'deleted_at' => $this->dateTime(),
                'deleted_by' => $this->integer()->defaultValue('0'),
                'created_by' => $this->integer(),
                'updated_by' => $this->integer(),
                'name' => $this->string()->notNull(),
                'global_id' => $this->integer()->notNull()->defaultValue('0'),
                'global_enabled' => $this->boolean()->notNull()->defaultValue('0'),
                'is_active' => $this->boolean()->notNull()->defaultValue('1'),
            ],
            $tableOptions
        );

        $this->createIndex('user_id', '{{%category}}', ['user_id']);

        $this->addForeignKey(
            'rtm_category_ibfk_1',
            '{{%category}}',
            ['user_id'],
            '{{%user}}',
            ['id'],
            'RESTRICT',
            'NO ACTION'
        );
    }

    public function down()
    {
        $this->dropTable('{{%category}}');
    }
}

from yii2-migration.

bizley avatar bizley commented on May 28, 2024

Next time please create a new issue for a new problem. I've run this migration locally and I cannot see any problem. Please provide all relevant migrations and the exact command you are using to run them.

from yii2-migration.

optmsp avatar optmsp commented on May 28, 2024

Okay, I thought about creating a new issue but sometimes people want a thread to play out. It's a 50/50 thing. I can create a new issue now and start from there to keep this thread clean?

from yii2-migration.

Related Issues (20)

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.