Comments (10)
Great! Glad I could help. Can we close this then or should we do more here?
from yii2-migration.
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.
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.
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.
will try upgrading mysql version and see if it removes error
from yii2-migration.
Upgrading mysql version did not solve the issue
from yii2-migration.
Ok, so my request stands. Exact steps to reproduce the issue with migrations for related tables.
from yii2-migration.
Have included related table migrations
Steps to reproduce are:-
Through console (am on a windows machine),
- running ./yii migrate/up(on production) or ./yii migrate/fresh(for development). ✔️
- 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.
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.
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 setexperimental
(orex
) 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)
- Dependabot can't resolve your PHP dependency files
- [Bug] update after renameTable() HOT 1
- [Bug] Missing compatibility with MySQL 8
- [Bug] update of a migration does not work without Yii autoloader HOT 4
- [Bug] > SQLSTATE[08004] [1040] Too many connections HOT 1
- [Bug] Asterisk not working with migration/create HOT 5
- get all data from table HOT 1
- [Bug] Primary key not included as index in StructureBuilder::addHiddenIndexes() for MySQL dbs
- [Feature] Different timestamp for migration file names as Yii operates on time and breaks the migration processes HOT 3
- [Bug] Problem with parsing ENUMS in migrations
- [Q] Unable to get Migration Working Correctly HOT 2
- Unclear of the cause of migration/update causing: [23000]: Integrity constraint violation HOT 7
- Migration/Update drops column instead of using renameColumn command HOT 1
- migration/update produces: Column data must be provided as an instance of yii\db\ColumnSchemaBuilder HOT 1
- [Bug] Primary Key Int Length setting to 10 instead of 11 HOT 3
- [Bug] Dropping table with foreign key on update
- [Bug] Setting default values using expressions fails HOT 11
- [Bug] Invalid path alias: @bizley/migration/views/migration.php HOT 4
- [Bug] Multiple definitions exist for class 'Migration' HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yii2-migration.