createTable('Incidente', [ "id" => $this->string(36), "nombre" => $this->string(100)->notNull(), "fechaIncidente" => $this->timestamp()->append(" with time zone"), "idObra" => $this->string(36), "descripcion" => $this->string(100)->notNull(), "creado" => $this->timestamp()->append(" with time zone"), "modificado" => $this->timestamp()->append(" with time zone"), "eliminado" => $this->timestamp()->append(" with time zone"), ]); $this->addForeignKey("IncidenteObraFK", "Incidente", "idObra", "Obra", "id"); $this->addPrimaryKey('IncidentePK', 'Incidente', 'id'); $this->createTable("IncidenteEmpleado", [ "id" => $this->string(36), "idIncidente" => $this->string(36), "idEmpleado" => $this->string(36), "creado" => $this->timestamp()->append("with time zone"), "modificado" => $this->timestamp()->append("with time zone"), "eliminado" => $this->timestamp()->append("with time zone"), ]); $this->addPrimaryKey('IncidenteEmpleadoPK', 'IncidenteEmpleado', 'id'); $this->addForeignKey('IncidenteEmpleadoIncidenteFK', 'IncidenteEmpleado', 'idIncidente', 'Incidente', 'id'); $this->addForeignKey('IncidenteEmpleadoEmpleadoFK', 'IncidenteEmpleado', 'idEmpleado', 'Empleado', 'id'); } /** * {@inheritdoc} */ public function safeDown() { $this->dropForeignKey("IncidenteObraFK", "Incidente"); $this->dropTable('Incidente'); $this->dropForeignKey('IncidenteEmpleadoIncidenteFK', "IncidenteEmpleado"); $this->dropForeignKey('IncidenteEmpleadoEmpleadoFK', "IncidenteEmpleado"); $this->dropTable('IncidenteEmpleado'); } /* // Use up()/down() to run migration code without a transaction. public function up() { } public function down() { echo "m240927_010701_Tabla_Incidente_e_IncidenteEmpleado cannot be reverted.\n"; return false; } */ }