Skip to content
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

Incorrect determining of default value for column #10848

Closed
sergeyklay opened this issue Aug 27, 2015 · 1 comment
Closed

Incorrect determining of default value for column #10848

sergeyklay opened this issue Aug 27, 2015 · 1 comment

Comments

@sergeyklay
Copy link
Contributor

How to reproduce:

use Phalcon\Db\Adapter\Pdo\Mysql;
use Phalcon\Db\Column;

$connection = new Mysql([
    'host'       => 'localhost',
    'username'   => 'root',
    'password'   => '',
    'dbname'     => 'devtools_issue_429',
    'port'       => '',
    'persistent' => true,
    'options'    => [
        PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES 'UTF8'",
        PDO::ATTR_CASE               => PDO::CASE_LOWER
    ],
]);

$column = new Column('status', [
    'type'    => Column::TYPE_INTEGER,
    'notNull' => true,
    'size'    => 1,
    'default' => 0
]);

$connection->createTable('user', '', ['columns' => [$column]]);

actual

CREATE TABLE `user` (
  `status` int(1) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8

expected

CREATE TABLE `user` (
  `status` int(1) NOT NULL DEFAULT '0'
) ENGINE=InnoDB DEFAULT CHARSET=utf8
@sergeyklay
Copy link
Contributor Author

Refs phalcon/phalcon-devtools#429

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant