Basic information:
php7.2-phalcon=3.4.2-2
Phalcon DevTools (3.4.0)
mysql: 5.7.25
I have a table:
> CREATE TABLE data
(
id int auto_increment primary key,
amount double not null,
created_at datetime not null
);
Create migrations for it through dev tools command:
phalcon migration generate --table=data --config=../../config/config.php --migrations=/application/app/modules/test/migrations
Get such migration:
...
class DataMigration_101 extends Migration
{
/**
* Define the table structure
*
* @return void
*/
public function morph()
{
$this->morphTable('Data', [
'columns' => [
new Column(
'id',
[
'type' => Column::TYPE_INTEGER,
'notNull' => true,
'autoIncrement' => true,
'size' => 11,
'first' => true
]
),
new Column(
'amount',
[
'type' => Column::TYPE_DOUBLE,
'notNull' => true,
'size' => 1,
'after' => 'id'
]
),
new Column(
'created_at',
[
'type' => Column::TYPE_DATETIME,
'notNull' => true,
'size' => 1,
'after' => 'amount'
]
)
],
'indexes' => [
new Index('PRIMARY', ['id'], 'PRIMARY')
],
'options' => [
'TABLE_TYPE' => 'BASE TABLE',
'AUTO_INCREMENT' => '1',
'ENGINE' => 'InnoDB',
'TABLE_COLLATION' => 'utf8_general_ci'
],
]
);
}
...
After that I drop table and try restore it from migration through dev tools:
phalcon migration run --config=../../config/config.php --migrations=/application/app/modules/test/migrations
And get the error:
> ERROR: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') NOT NULL,
`created_at` DATETIME NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB' at line 3
I have the situation when migrations were created successfully but I cannot used them? What wrong?
P/S: If change Column::TYPE_DOUBLE on 'double' command "phalcon migration run ..." will pass without errors but it is not a normal situation or maybe I do something wrong.
Help, please.