Coder Social home page Coder Social logo

Comments (10)

bizley avatar bizley commented on June 12, 2024 3

Great! Glad I could help. Can we close this then or should we do more here?

from yii2-migration.

bizley avatar bizley commented on June 12, 2024

Your migration looks good. Unfortunately I cannot repeat the bug with simple applying the above (I removed FK because I don't have the info about the related tables), changing something, and running migration/update. Could you provide the exact steps to reproduce your issue? With migrations for related tables and info about the database engine as well.

from yii2-migration.

sourabh-openinfotech avatar sourabh-openinfotech commented on June 12, 2024

Using InnoDB Version 5.6.39-83.1. I have just migrated up, I think there is difference is some migrations $tableOptions = 'CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE=InnoDB'; which differs from current migration $tableOptions = 'CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci ENGINE=InnoDB'; . Would this lead to error?

from yii2-migration.

bizley avatar bizley commented on June 12, 2024

I don't think so. That should not be a subject of comparison. Maybe there is something with that MySQL 5.6 version that causes the problem (it's 8 years old) - I'm testing this package on 5.7 and 8.0 only.

from yii2-migration.

sourabh-openinfotech avatar sourabh-openinfotech commented on June 12, 2024

will try upgrading mysql version and see if it removes error

from yii2-migration.

sourabh-openinfotech avatar sourabh-openinfotech commented on June 12, 2024

Upgrading mysql version did not solve the issue

from yii2-migration.

bizley avatar bizley commented on June 12, 2024

Ok, so my request stands. Exact steps to reproduce the issue with migrations for related tables.

from yii2-migration.

sourabh-openinfotech avatar sourabh-openinfotech commented on June 12, 2024

Have included related table migrations

Steps to reproduce are:-
Through console (am on a windows machine),

  1. running ./yii migrate/up(on production) or ./yii migrate/fresh(for development). ✔️
  2. running ./yii migration/update client_invoice_item_table (after making width and height nullable in the actual database table, want this to be reflected in migration). ❌

from yii2-migration.

bizley avatar bizley commented on June 12, 2024

I run the steps (except the customer_company_details table which definition is missing but it should not be a problem) and everything works. I ended with migration

<?php

use yii\db\Migration;

class m210415_105710_update_table_client_invoice_item_table extends Migration
{
    public function up()
    {
        $this->alterColumn('{{%client_invoice_item_table}}', 'width', $this->double());
        $this->alterColumn('{{%client_invoice_item_table}}', 'height', $this->double());
    }

    public function down()
    {
        $this->alterColumn('{{%client_invoice_item_table}}', 'width', $this->double()->notNull());
        $this->alterColumn('{{%client_invoice_item_table}}', 'height', $this->double()->notNull());
    }
}

Error message Column data must be provided as an instance of yii\db\ColumnSchemaBuilder pops up when you provide column definition as a string (like 'name' => 'varchar(255)') instead of an object (like 'name' => $this->string(255)) and you don't set experimental (or ex) mode on.

But I don't see it in your files here. I'm afraid I need to ask you to dig into this more in order to help.
$columnData info before it hits that line would be helpful.

from yii2-migration.

sourabh-openinfotech avatar sourabh-openinfotech commented on June 12, 2024

I run the steps (except the customer_company_details table which definition is missing but it should not be a problem) and everything works. I ended with migration

<?php

use yii\db\Migration;

class m210415_105710_update_table_client_invoice_item_table extends Migration
{
    public function up()
    {
        $this->alterColumn('{{%client_invoice_item_table}}', 'width', $this->double());
        $this->alterColumn('{{%client_invoice_item_table}}', 'height', $this->double());
    }

    public function down()
    {
        $this->alterColumn('{{%client_invoice_item_table}}', 'width', $this->double()->notNull());
        $this->alterColumn('{{%client_invoice_item_table}}', 'height', $this->double()->notNull());
    }
}

Error message Column data must be provided as an instance of yii\db\ColumnSchemaBuilder pops up when you provide column definition as a string (like 'name' => 'varchar(255)') instead of an object (like 'name' => $this->string(255)) and you don't set experimental (or ex) mode on.

But I don't see it in your files here. I'm afraid I need to ask you to dig into this more in order to help.
$columnData info before it hits that line would be helpful.

Thank you found the issue, one of the migrations had 'status' => "ENUM('Scheduled', 'Completed')" which was resulting in error. The error was so vague could't find anything on it.

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.