m240717_221515_tablas_taller_vehiculo.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. use yii\db\Migration;
  3. /**
  4. * Class m240717_221515_tablas_taller_vehiculo
  5. */
  6. class m240717_221515_tablas_taller_vehiculo extends Migration
  7. {
  8. /**
  9. * {@inheritdoc}
  10. */
  11. public function safeUp() {
  12. $this->createTable('Taller', [
  13. "id" => $this->string(36),
  14. "nombre" => $this->string(100)->notNull(),
  15. "direccion" => $this->string(100)->notNull(),
  16. "mecanico" => $this->string(100)->notNull(),
  17. "descripcion" => $this->text(),
  18. "telefono" => $this->integer(10),
  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("TallerPK", "Taller", "id");
  24. $this->createTable('Vehiculo', [
  25. "id" => $this->string(36),
  26. "nombre" => $this->string(100),
  27. "ano" => $this->integer(4),
  28. "color" => $this->string(100),
  29. "placa" => $this->string(100),
  30. "serie" => $this->string(100),
  31. "creado" => $this->timestamp()->append(" with time zone"),
  32. "modificado" => $this->timestamp()->append(" with time zone"),
  33. "eliminado" => $this->timestamp()->append(" with time zone"),
  34. ]);
  35. $this->addPrimaryKey("VehiculoPK", "Vehiculo", "id");
  36. }
  37. /**
  38. * {@inheritdoc}
  39. */
  40. public function safeDown() {
  41. $this->dropTable('Vehiculo');
  42. $this->dropTable('Taller');
  43. }
  44. }