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

Error duplicate columns while Auto-generate migration Postgres #438

Closed
whdigger opened this issue Jun 30, 2015 · 3 comments
Closed

Error duplicate columns while Auto-generate migration Postgres #438

whdigger opened this issue Jun 30, 2015 · 3 comments

Comments

@whdigger
Copy link
Contributor

Not right create columns in file scripts/Phalcon/Mvc/Model/Migration.php

Generating File:

            'references' => array(
                new Reference('fk_user_id', array(
                    'referencedSchema' => 'cbv',
                    'referencedTable' => 'user_user',
                    'columns' => array('user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id','user_id'),
                    'referencedColumns' => array('id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id','id')
                )),
                new Reference('fk_img_group_id', array(
                    'referencedSchema' => 'cbv',
                    'referencedTable' => 'img_group',
                    'columns' => array('img_group_id','img_group_id','img_group_id','img_group_id','img_group_id','img_group_id','img_group_id','img_group_id','img_group_id'),
                    'referencedColumns' => array('id','id','id','id','id','id','id','id','id')
                ))
            ),

Sql File

CREATE TABLE travel_report
(
  id           SERIAL                      NOT NULL PRIMARY KEY,
  travel_id    INTEGER,
  date_create  TIMESTAMP WITHOUT TIME ZONE NOT NULL DEFAULT now(),
  date_change  TIMESTAMP WITHOUT TIME ZONE NOT NULL,
  user_id      INTEGER,
  img_group_id INTEGER,
  CONSTRAINT fk_user_id FOREIGN KEY (user_id) REFERENCES "user_user" (id) ON UPDATE NO ACTION ON DELETE CASCADE,
  CONSTRAINT fk_img_group_id FOREIGN KEY (img_group_id) REFERENCES "img_group" (id) ON UPDATE NO ACTION ON DELETE CASCADE
);
@sergeyklay
Copy link
Contributor

@Mesgen

  1. Create in separated issue
  2. You should install Phalcon 2.0 first. Or if you don't need Phalcon:
$ php composer.phar install --ignore-platform-reqs

@ricksanchez
Copy link

this also affects mysql, so it is not a problem only for postgresql

new Reference(
                        'fk_site_culture_site',
                        array(
                            'referencedSchema' => 'project',
                            'referencedTable' => 'site',
                            'columns' => array('site_id','site_id'),
                            'referencedColumns' => array('id','id'),
                            'onUpdate' => 'CASCADE',
                            'onDelete' => 'CASCADE'
                        )
                    )

@sergeysviridenko
Copy link
Contributor

sergeysviridenko commented Jul 19, 2017

The describeReferences method works fine. @Arrim was fixed this issue for Postgresql and MySQL.
I guess this issue can be closed.

Phalcon DevTools Version 3.2.0
Phalcon Version | 3.2.1

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

4 participants