Parcourir la source

Se agrego columna idSagarhpa en tablas munmicipio y estado

Jose Cienfuegos il y a 10 mois
Parent
commit
24f1fb4bd7

+ 27 - 0
migrations/m240626_181104_columna_idSagarhpa_en_catalogos.php

@@ -0,0 +1,27 @@
+<?php
+
+use yii\db\Migration;
+
+/**
+ * Class m240626_181104_columna_idSagarhpa_en_catalogos
+ */
+class m240626_181104_columna_idSagarhpa_en_catalogos extends Migration
+{
+    /**
+     * {@inheritdoc}
+     */
+    public function safeUp()
+    {
+        $this->addColumn('Estado', 'idSagarhpa', $this->integer());
+        $this->addColumn('Municipio', 'idSagarhpa', $this->integer());
+    }
+
+    /**
+     * {@inheritdoc}
+     */
+    public function safeDown()
+    {
+        $this->dropColumn('Municipio', 'idSagarhpa', $this->integer());
+        $this->dropColumn('Estado', 'idSagarhpa', $this->integer());
+    }
+}

+ 2 - 0
models/Estado.php

@@ -34,6 +34,7 @@ class Estado extends ModeloBase {
       /* [['clave'], 'integer'], */
       [['creado', 'modificado', 'eliminado'], 'safe'],
       [['id', 'pais'], 'string', 'max' => 36],
+      [['idSagarhpa'], 'integer'],
       [['nombre'], 'string', 'max' => 100],
       [['abreviacion'], 'string', 'max' => 16],
       [['id'], 'unique'],
@@ -46,6 +47,7 @@ class Estado extends ModeloBase {
   public function attributeLabels() {
     return [
       'id' => 'ID',
+      'idSagarhpa' => 'ID Sagarhpa',
       'nombre' => 'Nombre',
       'abreviacion' => 'Abreviacion',
       'creado' => 'Creado',

+ 2 - 0
models/Municipio.php

@@ -35,6 +35,7 @@ class Municipio extends ModeloBase {
       [['id', 'idEstado'], 'string', 'max' => 36],
       [['nombre'], 'string', 'max' => 100],
       [['id'], 'unique'],
+      [['idSagarhpa'], 'integer'],
       [['idEstado'], 'exist', 'skipOnError' => true, 'targetClass' => Estado::class, 'targetAttribute' => ['idEstado' => 'id']],
     ];
   }
@@ -45,6 +46,7 @@ class Municipio extends ModeloBase {
   public function attributeLabels() {
     return [
       'id' => 'ID',
+      'idSagarhpa' => 'ID Sagarhpa',
       'nombre' => 'Nombre',
       'idEstado' => 'Id Estado',
       'creado' => 'Creado',

+ 1 - 0
modules/v1/models/Estado.php

@@ -7,6 +7,7 @@ class Estado extends \app\models\Estado {
   public function fields() {
     return [
       "id",
+      'idSagarhpa',
       "nombre",
       "abreviacion",
       "creado",

+ 1 - 0
modules/v1/models/Municipio.php

@@ -7,6 +7,7 @@ class Municipio extends \app\models\Municipio {
   public function fields() {
     return [
       'id',
+      'idSagarhpa',
       'nombre',
       'idEstado',
       'creado',