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

PostgreSQL migrations - default values in double quotes #859

Closed
radeczo opened this issue Sep 27, 2016 · 1 comment
Closed

PostgreSQL migrations - default values in double quotes #859

radeczo opened this issue Sep 27, 2016 · 1 comment

Comments

@radeczo
Copy link
Contributor

radeczo commented Sep 27, 2016

Hi.

Phalcon DevTools (3.0.0)

Default values in PostgreSQL should be in single quotes (for strings) or as an number (for int, bigint, etc.). Double quoted values Postgres interprets as column names.

Error example:

Column definition:

new Column(
    'status',
    [
        'type' => Column::TYPE_INTEGER,
        'default' => "1",
        'after' => 'order'
    ]
),

Generated SQL:

CREATE TABLE "public"."table" (
    ...
    "status" INT DEFAULT "1",
    ...
);

Postgres error:
ERROR: SQLSTATE[42703]: Undefined column: 7 ERROR: column "1" does not exist

@sergeyklay
Copy link
Contributor

@radeczo

I've fixed this issue in the Phalcon 3.0.x branch. You need to update Phalcon:

git clone git@github.com:phalcon/cphalcon.git
cd cphalcon
git checkout 3.0.x

zephir fullclean
zephir build

Thank you for contributing!

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

No branches or pull requests

2 participants