migrations/Version20250128195539.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 Version20250128195539 extends AbstractMigration
  10.     {
  11.         public function getDescription(): string
  12.         {
  13.             return '';
  14.         }
  15.         public function up(Schema $schema): void
  16.         {
  17.             $this->addSql('alter view report_total_or_installments_count as
  18. select a.academic_year AS academic_year, a.title AS title, count(0) AS total
  19. from (select e.academic_year   AS academic_year,
  20.              (case
  21.                   when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
  22.                   else \'Rate\' end) AS title
  23.       from ((((udg_fms.students s left join udg_fms.profiles p
  24.                on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
  25.               on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
  26.              on ((e.tuition_modality_template_id = t.id))) left join udg_fms.tuition_installments i
  27.             on ((e.id = i.enrollment_id)))
  28.       where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
  29.              (i.payed_on is not null) and (t.covered = 0))
  30.       group by e.academic_year, i.title, (case
  31.                                          when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\'))
  32.                                              then \'Uplata u cjelosti\'
  33.                                          else \'Rate\' end), s.faculty, s.first_name, s.last_name,
  34.                p.index_no, p.current_semester, t.title) a
  35. group by a.academic_year, a.title');
  36.             $this->addSql('create view report_total_of_sponsored_students_by_faculty_and_type as
  37. select e.academic_year, p.faculty, t.title as type, count(s.id) as total
  38. from students s
  39.          left join profiles p
  40.                    on s.id = p.student_id
  41.          left join enrollment_events e
  42.                    on e.profile_id = p.id
  43.          left join tuition_modality_templates t
  44.                    on e.tuition_modality_template_id = t.id
  45. where t.covered = 1
  46.   and e.academic_year is not null
  47. group by e.academic_year,p.faculty, t.title');
  48.             $this->addSql('create view report_total_or_installments_count_with_covered as
  49. select a.academic_year AS academic_year, a.title AS title, count(0) AS total
  50. from (select e.academic_year   AS academic_year,
  51.              (case
  52.                   when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
  53.                   else \'Rate\' end) AS title
  54.       from ((((udg_fms.students s left join udg_fms.profiles p
  55.                on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
  56.               on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
  57.              on ((e.tuition_modality_template_id = t.id))) left join udg_fms.tuition_installments i
  58.             on ((e.id = i.enrollment_id)))
  59.       where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
  60.              (i.payed_on is not null) and (t.covered = 0))
  61.       group by e.academic_year,
  62.                i.title,
  63.                (case
  64.                     when (t.covered = 1) then \'Stipendija\'
  65.                     when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
  66.                     else \'Rate\' end), s.faculty, s.first_name, s.last_name, p.index_no,
  67.                p.current_semester, t.title
  68.       union all
  69.       select e.academic_year   AS academic_year, \'Stipendija\'AS title
  70.       from ((((udg_fms.students s left join udg_fms.profiles p
  71.                on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
  72.               on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
  73.              on ((e.tuition_modality_template_id = t.id))))
  74.       where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
  75.              (t.covered = 1))
  76.       group by e.academic_year, s.faculty, s.first_name, s.last_name, p.index_no,
  77.                p.current_semester, t.title
  78.       ) a
  79. group by a.academic_year, a.title');
  80.         }
  81.         public function down(Schema $schema): void
  82.         {
  83.             // this down() migration is auto-generated, please modify it to your needs
  84.             $this->addSql('alter view report_total_or_installments_count as
  85. select a.academic_year AS academic_year, a.title AS title, count(0) AS total
  86. from (select e.academic_year   AS academic_year,
  87.              (case
  88.                   when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
  89.                   else \'Rate\' end) AS title
  90.       from ((((udg_fms.students s left join udg_fms.profiles p
  91.                on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
  92.               on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
  93.              on ((e.tuition_modality_template_id = t.id))) left join udg_fms.tuition_installments i
  94.             on ((e.id = i.enrollment_id)))
  95.       where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
  96.              (i.payed_on is not null))
  97.       group by e.academic_year,i.title, (case
  98.                                          when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\'))
  99.                                              then \'Uplata u cjelosti\'
  100.                                          else \'Rate\' end), s.faculty, s.first_name, s.last_name,
  101.                p.index_no, p.current_semester, t.title) a
  102. group by a.academic_year, a.title;');
  103.             $this->addSql('drop view report_total_of_sponsored_students_by_faculty_and_type');
  104.             $this->addSql('drop view report_total_or_installments_count_with_covered');
  105.         }
  106.     }