<?php
declare(strict_types = 1);
namespace DoctrineMigrations;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\Migrations\AbstractMigration;
/**
* Auto-generated Migration: Please modify to your needs!
*/
final class Version20250128195539 extends AbstractMigration
{
public function getDescription(): string
{
return '';
}
public function up(Schema $schema): void
{
$this->addSql('alter view report_total_or_installments_count as
select a.academic_year AS academic_year, a.title AS title, count(0) AS total
from (select e.academic_year AS academic_year,
(case
when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
else \'Rate\' end) AS title
from ((((udg_fms.students s left join udg_fms.profiles p
on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
on ((e.tuition_modality_template_id = t.id))) left join udg_fms.tuition_installments i
on ((e.id = i.enrollment_id)))
where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
(i.payed_on is not null) and (t.covered = 0))
group by e.academic_year, i.title, (case
when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\'))
then \'Uplata u cjelosti\'
else \'Rate\' end), s.faculty, s.first_name, s.last_name,
p.index_no, p.current_semester, t.title) a
group by a.academic_year, a.title');
$this->addSql('create view report_total_of_sponsored_students_by_faculty_and_type as
select e.academic_year, p.faculty, t.title as type, count(s.id) as total
from students s
left join profiles p
on s.id = p.student_id
left join enrollment_events e
on e.profile_id = p.id
left join tuition_modality_templates t
on e.tuition_modality_template_id = t.id
where t.covered = 1
and e.academic_year is not null
group by e.academic_year,p.faculty, t.title');
$this->addSql('create view report_total_or_installments_count_with_covered as
select a.academic_year AS academic_year, a.title AS title, count(0) AS total
from (select e.academic_year AS academic_year,
(case
when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
else \'Rate\' end) AS title
from ((((udg_fms.students s left join udg_fms.profiles p
on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
on ((e.tuition_modality_template_id = t.id))) left join udg_fms.tuition_installments i
on ((e.id = i.enrollment_id)))
where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
(i.payed_on is not null) and (t.covered = 0))
group by e.academic_year,
i.title,
(case
when (t.covered = 1) then \'Stipendija\'
when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
else \'Rate\' end), s.faculty, s.first_name, s.last_name, p.index_no,
p.current_semester, t.title
union all
select e.academic_year AS academic_year, \'Stipendija\'AS title
from ((((udg_fms.students s left join udg_fms.profiles p
on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
on ((e.tuition_modality_template_id = t.id))))
where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
(t.covered = 1))
group by e.academic_year, s.faculty, s.first_name, s.last_name, p.index_no,
p.current_semester, t.title
) a
group by a.academic_year, a.title');
}
public function down(Schema $schema): void
{
// this down() migration is auto-generated, please modify it to your needs
$this->addSql('alter view report_total_or_installments_count as
select a.academic_year AS academic_year, a.title AS title, count(0) AS total
from (select e.academic_year AS academic_year,
(case
when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\')) then \'Uplata u cjelosti\'
else \'Rate\' end) AS title
from ((((udg_fms.students s left join udg_fms.profiles p
on ((s.id = p.student_id))) left join udg_fms.enrollment_events e
on ((e.profile_id = p.id))) left join udg_fms.tuition_modality_templates t
on ((e.tuition_modality_template_id = t.id))) left join udg_fms.tuition_installments i
on ((e.id = i.enrollment_id)))
where ((e.academic_year is not null) and (e.tuition_modality_template_id is not null) and
(i.payed_on is not null))
group by e.academic_year,i.title, (case
when (i.title in (\'U cjelosti\', \'Uplata u cjelosti\'))
then \'Uplata u cjelosti\'
else \'Rate\' end), s.faculty, s.first_name, s.last_name,
p.index_no, p.current_semester, t.title) a
group by a.academic_year, a.title;');
$this->addSql('drop view report_total_of_sponsored_students_by_faculty_and_type');
$this->addSql('drop view report_total_or_installments_count_with_covered');
}
}