migrations/Version20211211182912.php line 1

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace DoctrineMigrations;
  4. use Doctrine\DBAL\Schema\Schema;
  5. use Doctrine\Migrations\AbstractMigration;
  6. /**
  7.  * Auto-generated Migration: Please modify to your needs!
  8.  */
  9. final class Version20211211182912 extends AbstractMigration
  10. {
  11.     public function getDescription(): string
  12.     {
  13.         return '';
  14.     }
  15.     public function up(Schema $schema): void
  16.     {
  17.        $this->addSql("ALTER TABLE notifications.templates ADD COLUMN type smallint DEFAULT 1 ");
  18.         $this->addSql("
  19.         CREATE TABLE notifications.push_mobiles (
  20.             id SERIAL,
  21.             content TEXT NOT NULL,
  22.             context JSON DEFAULT NULL,
  23.             user_id INT DEFAULT NULL,
  24.             status SMALLINT DEFAULT 0,
  25.             created_at timestamp(0) without time zone DEFAULT NOW()::timestamp without time zone,
  26.             updated_at timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
  27.             deleted_at timestamp(0) without time zone DEFAULT NULL::timestamp without time zone,
  28.             created_by integer,
  29.             updated_by integer,
  30.             deleted_by integer,
  31.             enabled smallint DEFAULT 1 NOT NULL,
  32.             deleted smallint DEFAULT 0 NOT NULL,
  33.             PRIMARY KEY(id)
  34.         )
  35.        ");
  36.         $this->addSql("
  37.         CREATE TRIGGER tgr_push_mobiles__main_table_history
  38.             BEFORE INSERT OR UPDATE
  39.             ON notifications.push_mobiles
  40.             FOR EACH ROW EXECUTE PROCEDURE main_table_history();
  41.         
  42.         ");
  43.     }
  44.     public function down(Schema $schema): void
  45.     {
  46.         $this->addSql("ALTER TABLE notifications.templates DROP COLUMN type;");
  47.         $this->addSql("DROP TABLE notifications.push_mobiles");
  48.     }
  49. }