| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- use yii\db\Migration;
- /**
- * Class m230420_191735_notificaciones
- */
- class m230420_191735_notificaciones extends Migration {
- /**
- * {@inheritdoc}
- */
- public function safeUp() {
- $this->createTable('Notificacion', [
- 'id' => $this->primaryKey(),
- 'envio' => $this->timestamp().' with time zone',
- 'estatus' => $this->string(10),
- 'creado' => $this->timestamp().' with time zone',
- 'modificado' => $this->timestamp().' with time zone',
- 'detalle' => $this->json()
- ]);
- $this->createTable('NotificacionUsuario', [
- 'id' => $this->primaryKey(),
- 'idNotificacion' => $this->integer(),
- 'idUsuario' => $this->integer(),
- 'nombre' => $this->string(100),
- 'telefono' => $this->string(10),
- 'parametros' => $this->json(),
- 'detalle' => $this->json()
- ]);
- $this->addForeignKey('NotificacionUsuario_idNotificacion_FK', 'NotificacionUsuario', 'idNotificacion', 'Notificacion', 'id');
- $this->addForeignKey('NotificacionUsuario_idUsuario_FK', 'NotificacionUsuario', 'idUsuario', 'Usuario', 'id');
- }
- /**
- * {@inheritdoc}
- */
- public function safeDown() {
- $this->dropForeignKey('NotificacionUsuario_idUsuario_FK', 'NotificacionUsuario');
- $this->dropForeignKey('NotificacionUsuario_idNotificacion_FK', 'NotificacionUsuario');
- $this->dropTable('NotificacionUsuario');
- $this->dropTable('Notificacion');
- }
- }
|