0
votes

I have those entities, on each entity is defined "name" and "schema" on parameters in @ORM\Table annotation, but doctrine don't dump the schema on sql.

UPDATE: if i change the @ORM\Table parameters to (name="RRHH.usuario") the dump don't show the sql, now i am using "doctrine/orm": "~2.2,>=2.2.3" and "doctrine/doctrine-bundle": "v1.2.0".

UPDATE: Version "doctrine/orm": "2.4.@dev", "doctrine/doctrine-bundle": "1.3.@dev", same problem.

/**
 *  Entidad Usuario
 *
 * @ORM\Entity
 * @ORM\Table(name="usuario", schema="RRHH")
 */
class Usuario implements UserInterface
{
...
}

/**
 * Entidad Rol
 *
 * @ORM\Entity
 * @ORM\Table(name="rol", schema="RRHH")
 */
class Rol implements RoleInterface{
...
}

php app/console doctrine:schema:create --dump-sql

CREATE TABLE rol
(
   id     NUMBER(10) NOT NULL,
   nombre VARCHAR2(255) NOT NULL,
   PRIMARY KEY(id)
);

CREATE TABLE usuario
  (
    id       NUMBER(10) NOT NULL,
    usuario  VARCHAR2(255) NOT NULL,
    password VARCHAR2(255) NOT NULL,
    salt     VARCHAR2(255) NOT NULL,
    PRIMARY KEY(id)
  );

CREATE TABLE usuario_rol
  (
    usuario_id NUMBER(10) NOT NULL,
    rol_id     NUMBER(10) NOT NULL,
    PRIMARY KEY(usuario_id, rol_id)
  );

CREATE INDEX IDX_72EDD1A4DB38439E ON usuario_rol (usuario_id);
CREATE INDEX IDX_72EDD1A44BAB96C ON usuario_rol(rol_id);

CREATE SEQUENCE rol_id_seq START WITH 1 MINVALUE 1 INCREMENT BY 1;

CREATE SEQUENCE usuario_id_seq START WITH 1 MINVALUE 1 INCREMENT BY 1;

ALTER TABLE usuario_rol ADD CONSTRAINT FK_72EDD1A4DB38439E FOREIGN KEY (usuario_id) REFERENCES usuario (id);

 ALTER TABLE usuario_rol ADD CONSTRAINT FK_72EDD1A44BAB96C FOREIGN KEY (rol_id) REFERENCES rol (id);
1

1 Answers

0
votes

According to doc there is no schema option in annotations. Workaround for this might be pointing schema in your tablename, so:

/**
 *  Entidad Usuario
 *
 * @ORM\Entity
 * @ORM\Table(name="rrhh.usuario")
 */
class Usuario implements UserInterface
{
...
}