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 fActiveRecord::populate sets auto_increment field to 0 as default #216

Open
kwarunek opened this issue Mar 17, 2015 · 0 comments

Comments

@kwarunek
Copy link

PostgreSQL definiton:

    some_id bigint NOT NULL DEFAULT nextval('seq_some_id'::regclass),

Flourish column's info:

Array (
    [type] => integer
    [min_value] => fNumber Object
        (
            [scale:fNumber:private] => 0
            [value:fNumber:private] => -9223372036854775808
        )
    [max_value] => fNumber Object
        (
            [scale:fNumber:private] => 0
            [value:fNumber:private] => +9223372036854775807
        )
    [auto_increment] => 1
    [not_null] => 1
    [comment] => 
    [placeholder] => %i
    [default] => 
    [valid_values] => 
    [max_length] => 
    [decimal_places] => 
)

As you can see default is not set https://github.com/flourishlib/flourish-classes/blob/master/fSchema.php#L1758.

fActiveDirectory::populate sets auto increment field to 0 (note: this field is not in request, of'course). This prevents fActiveDirectory::store to success on insert new row., 'cause it doesn't meet condition value === NULL

As flourish is deprecated library and it is abandoned, I won't provide PR - it wouldn't be merged. Simple workaround replace line:

    if ($schema->getColumnInfo($table, $column, 'auto_increment') && $schema->getColumnInfo($table, $column, 'not_null') && $this->values[$column] === NULL) {

with:

    if ($schema->getColumnInfo($table, $column, 'auto_increment') && $schema->getColumnInfo($table, $column, 'not_null') && !$this->values[$column]) {
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