繁体   English   中英

Propel2 diff使用PostgreSQL检测不存在的更改

[英]Propel2 diff detects non-existent changes with PostgreSQL

我正在使用带PostgreSQL的Propel2 ORM,这是我的配置:

propel:
database:
    connections:
        default:
            adapter: pgsql
            dsn: pgsql:host=localhost;port=5432;dbname=sps_db
            user: postgres
            password: postgres
            settings:
                charset: utf8

这是我的示例架构:

<?xml version="1.0" encoding="utf-8"?>
<database name="default" defaultIdMethod="native" defaultPhpNamingMethod="underscore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:noNamespaceSchemaLocation="http://xsd.propelorm.org/1.6/database.xsd" >
<table name="product" description="Available products table">
    <column name="id_product" autoIncrement="true" primaryKey="true" type="BIGINT" required="true"/>
    <column name="id_product_barcode" type="BIGINT" />
    <column name="name" type="VARCHAR" size="200" required="true" />
    <column name="id_product_manufacturer" type="INTEGER" required="true" />
    <column name="id_product_category" type="INTEGER" required="true"/>
    <column name="id_product_photo" type="BIGINT" />
</table>
</database>

PostgreSQL 9.5已经在Ubuntu 16.04上全新安装。 当我第一次运行propel diffpropel migrate时,一切正常并生成表格。

这是第一个生成的迁移: http//pastebin.com/hK9qwfeA

如果在不更改架构的情况下,我重新运行diff propel检测更改(不存在):

Comparing models...
Structure of database was modified in datasource "default": 1 modified tables

使用以下生成的迁移文件: http//pastebin.com/Yx143CKp

当然,如果我执行迁移文件SQL抱怨:

  [PDOException]                                                                                         
  SQLSTATE[42701]: Duplicate column: 7 ERROR:  column "id_product" of relation "product" already exists  

我无法弄清楚发生了什么。 所有这些,具有更复杂的模式(并且使用这个模式)也可以正常使用MySQL。

有任何想法吗?

编辑 :这是pgSql中第一次迁移中生成的表的SQL:

CREATE TABLE public.product
(
  id_product bigint NOT NULL DEFAULT nextval('product_id_product_seq'::regclass),
  id_product_barcode bigint,
  name character varying(200) NOT NULL,
  id_product_manufacturer integer NOT NULL,
  id_product_category integer NOT NULL,
  id_product_photo bigint,
  CONSTRAINT product_pkey PRIMARY KEY (id_product)
)
WITH (
  OIDS=FALSE
);
ALTER TABLE public.product
  OWNER TO postgres;
COMMENT ON TABLE public.product
  IS 'Available products table';

将PostgreSQL 9.5.x降级到9.4.8为我解决了这个问题。

它可能是9.5.x中的错误。

经过一些调试和调查(我们认为它是9.5元数据更改)后,我们发现了以下内容:

https://github.com/propelorm/Propel2/pull/1245

在postgresql 9.5中拆分模式时,它归结为一个简单的trim命令

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM