m240806_220757_tabla_color.php 1.1 KB

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