-
-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error running migrations #29
Comments
Could you provide |
Do you mean something like that? -- auto-generated definition
create table task_jobs
(
id int(20) auto_increment
)
charset = utf8mb4;
alter table task_jobs
add primary key (id); Table after migration -- auto-generated definition
create table task_jobs
(
id int(20) auto_increment,
task_id int(20) null,
run_at datetime not null,
status int(1) default 0 null,
result text null,
constraint task_jobs_id_uindex
unique (id),
constraint task_jobs_tasks_id_fk
foreign key (task_id) references tasks (id)
on delete set null
)
charset = utf8mb4;
alter table task_jobs
add primary key (id); |
Is table |
yes in the first run i create every table with the primary key and in the second run i add all other fields and relations |
Jeckerson
added a commit
that referenced
this issue
Jan 29, 2020
Jeckerson
added a commit
that referenced
this issue
Jan 29, 2020
Jeckerson
added a commit
that referenced
this issue
Jan 29, 2020
Jeckerson
added a commit
that referenced
this issue
Jan 29, 2020
Fixed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Currently i'm upgrading to devtools 4.0.0 and running in some strange issues.
Migrations are running fine with the old version
I have 2 migrations for the a table: 0.0.1 create table
$this->getConnection()->createTable( 'task_jobs', '', [ 'columns' => [ new Column( 'id', [ 'type' => Column::TYPE_INTEGER, 'size' => 20, 'notNull' => true, 'autoIncrement' => true, ] ), ], 'indexes' => [ new Index( 'PRIMARY', [ 'id' ], 'PRIMARY' ) ], 'options' => [ 'TABLE_TYPE' => 'BASE TABLE', 'AUTO_INCREMENT' => '1', 'ENGINE' => 'InnoDB', 'TABLE_COLLATION' => 'utf8mb4_general_ci' ], ] );
Second 0.1.0 creates the rest
$this->morphTable( 'task_jobs', [ 'columns' => [ new Column( 'id', [ 'type' => Column::TYPE_INTEGER, 'notNull' => true, 'autoIncrement' => true, 'size' => 20, 'first' => true ] ), new Column( 'task_id', [ 'type' => Column::TYPE_INTEGER, 'size' => 20, 'after' => 'id' ] ), new Column( 'run_at', [ 'type' => Column::TYPE_DATETIME, 'notNull' => true, 'size' => 1, 'after' => 'task_id' ] ), new Column( 'status', [ 'type' => Column::TYPE_INTEGER, 'default' => "0", 'size' => 1, 'after' => 'run_at' ] ), new Column( 'result', [ 'type' => Column::TYPE_TEXT, 'size' => 1, 'after' => 'status' ] ) ], 'indexes' => [ new Index( 'PRIMARY', [ 'id' ], 'PRIMARY' ), new Index( 'task_jobs_id_uindex', [ 'id' ], 'UNIQUE' ), new Index( 'task_jobs_tasks_id_fk', [ 'task_id' ], '' ) ], 'references' => [ new Reference( 'task_jobs_tasks_id_fk', [ 'referencedTable' => 'tasks', 'referencedSchema' => '', 'columns' => [ 'task_id' ], 'referencedColumns' => [ 'id' ], 'onUpdate' => 'RESTRICT', 'onDelete' => 'SET NULL' ] ) ], 'options' => [ 'TABLE_TYPE' => 'BASE TABLE', 'AUTO_INCREMENT' => '103706', 'ENGINE' => 'InnoDB', 'TABLE_COLLATION' => 'utf8mb4_general_ci' ], ] );
But now i get the error:
PHP Fatal error: Uncaught TypeError: Argument 2 passed to Phalcon\Db\Adapter\Pdo\Mysql::addForeignKey() must be of the type string, null given in /var/www/xxx/public_html/vendor/phalcon/migrations/src/Mvc/Model/Migration.php:728
if i change
$tableReference->getSchemaName()
to$tableReference->getSchemaName() ?? ''
it works fine.What do i need to set/enable what ever to fix that?
The text was updated successfully, but these errors were encountered: