m240809_172822_obra.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m240809_172822_obra
  5. */
  6. class m240809_172822_obra extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp()
  12. {
  13. $this->createTable('Obra', [
  14. "id" => $this->string(36),
  15. "nombre" => $this->string(100)->notNull(),
  16. "fechaInicio" => $this->timestamp()->append(" with time zone"),
  17. "fechaFinal" => $this->timestamp()->append(" with time zone"),
  18. "descripcion" => $this->string(100)->notNull(),
  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->addPrimaryKey('ObraPK', 'Obra', 'id');
  24. }
  25. /**
  26. * {@inheritdoc}
  27. */
  28. public function safeDown()
  29. {
  30. $this->dropTable('Obra');
  31. }
  32. /*
  33. // Use up()/down() to run migration code without a transaction.
  34. public function up()
  35. {
  36. }
  37. public function down()
  38. {
  39. echo "m240809_172822_obra cannot be reverted.\n";
  40. return false;
  41. }
  42. */
  43. }