m240926_165247_Tabla_Permiso_Creacion.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m240926_165247_Tabla_Permiso_Creacion
  5. */
  6. class m240926_165247_Tabla_Permiso_Creacion extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. $this->createTable('Permiso', [
  14. "id" => $this->string(36),
  15. "nombre" => $this->string(100),
  16. "idModulo" => $this->string(36),
  17. "clave" => $this->string(100),
  18. "descripcion"=> $this->string(100),
  19. "creado" => $this->timestamp()->append(" with time zone"),
  20. "modificado" => $this->timestamp()->append(" with time zone"),
  21. "eliminado" => $this->timestamp()->append(" with time zone"),
  22. ]);
  23. $this->addForeignKey("PermisosModuloFK", "Permiso", "idModulo", "Modulo", "id");
  24. $this->addPrimaryKey('PermisoPK', 'Permiso', 'id');
  25. }
  26. /**
  27. * {@inheritdoc}
  28. */
  29. public function safeDown()
  30. {
  31. $this->dropForeignKey("PermisosModuloFK", "Permiso");
  32. $this->dropTable('Permiso');
  33. }
  34. /*
  35. // Use up()/down() to run migration code without a transaction.
  36. public function up()
  37. {
  38. }
  39. public function down()
  40. {
  41. echo "m240926_165247_Tabla_Permiso_Creacion cannot be reverted.\n";
  42. return false;
  43. }
  44. */
  45. }