[i-Educar] Erro ao rodar migrations - Instalação

Olá pessoal, estou enfrentando um erro ao final da instalação do iEducar, no último passo composer new-install quando ele chega na etapa de php artisan migrate --force --ansi. Ao chegar na migration CreateRelatorioViewHistorico9anosView recebo o erro abaixo:

SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near "SELECT"
LINE 200:         SELECT
                  ^ (Connection: pgsql, SQL: CREATE OR REPLACE VIEW relatorio.view_historico_9anos AS
    SELECT
        historico_disciplinas.ref_ref_cod_aluno AS cod_aluno,
        historico_disciplinas.disciplina,
        (select ordenamento
          from pmieducar.historico_disciplinas s
          where ref_ref_cod_aluno = historico_disciplinas.ref_ref_cod_aluno
          and btrim(relatorio.get_texto_sem_caracter_especial(nm_disciplina::character varying)::text) = historico_disciplinas.disciplina
          and ordenamento is not null
          order by ref_sequencial desc
          limit 1) as ordenamento,
        (historico_por_disciplina.anos OPERATOR(relatorio.->) (((historico_disciplinas.disciplina || '-'::text) || '1'::text) || '-ano'::text))::integer AS ano_1serie,
        (historico_por_disciplina.anos OPERATOR(relatorio.->) (((historico_disciplinas.disciplina || '-'::text) || '2'::text) || '-ano'::text))::integer AS ano_2serie,

... continua mostrando o resto do sql

ORDER BY ordenamento, historico_disciplinas.disciplina;
) at /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php:822)
[stacktrace]
#0 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php(776): Illuminate\\Database\\Connection->runQueryCallback('CREATE OR REPLA...', Array, Object(Closure))
#1 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php(623): Illuminate\\Database\\Connection->run('CREATE OR REPLA...', Array, Object(Closure))
#2 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(509): Illuminate\\Database\\Connection->unprepared('CREATE OR REPLA...')
#3 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Database\\DatabaseManager->__call('unprepared', Array)
#4 /var/www/ieducar/database/migrations/2020_01_01_150000_create_relatorio_view_historico_9anos_view.php(19): Illuminate\\Support\\Facades\\Facade::__callStatic('unprepared', Array)
#5 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): CreateRelatorioViewHistorico9anosView->up()
#6 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\\Database\\Migrations\\Migrator->runMethod(Object(App\\Providers\\Postgres\\PostgresConnection), Object(CreateRelatorioViewHistorico9anosView), 'up')
#7 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(30): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}(Object(App\\Providers\\Postgres\\PostgresConnection))
#8 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(418): Illuminate\\Database\\Connection->transaction(Object(Closure))
#9 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->runMigration(Object(CreateRelatorioViewHistorico9anosView), 'up')
#10 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#11 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\\Console\\View\\Components\\Task->render('2020_01_01_1500...', Object(Closure))
#12 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->write('Illuminate\\\\Cons...', '2020_01_01_1500...', Object(Closure))
#13 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\\Database\\Migrations\\Migrator->runUp('/var/www/ieduca...', 1, false)
#14 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\\Database\\Migrations\\Migrator->runPending(Array, Array)
#15 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(90): Illuminate\\Database\\Migrations\\Migrator->run(Array, Array)
#16 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#17 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(83): Illuminate\\Database\\Migrations\\Migrator->usingConnection(NULL, Object(Closure))
#18 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle()
#19 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#20 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#21 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#22 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application),Array, Array, NULL)
#23 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call(Array)
#24 /var/www/ieducar/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#25 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#26 /var/www/ieducar/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#27 /var/www/ieducar/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Database\\Console\\Migrations\\MigrateCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#28 /var/www/ieducar/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#29 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#30 /var/www/ieducar/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#31 {main}

[previous exception] [object] (PDOException(code: 42601): SQLSTATE[42601]: Syntax error: 7 ERROR:  syntax error at or near \"SELECT\"
LINE 200:         SELECT
                  ^ at /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php:629)
[stacktrace]
#0 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php(629): PDO->exec('CREATE OR REPLA...')
#1 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php(809): Illuminate\\Database\\Connection->Illuminate\\Database\\{closure}('CREATE OR REPLA...', Array)
#2 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php(776): Illuminate\\Database\\Connection->runQueryCallback('CREATE OR REPLA...', Array, Object(Closure))
#3 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Connection.php(623): Illuminate\\Database\\Connection->run('CREATE OR REPLA...', Array, Object(Closure))
#4 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php(509): Illuminate\\Database\\Connection->unprepared('CREATE OR REPLA...')
#5 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Support/Facades/Facade.php(355): Illuminate\\Database\\DatabaseManager->__call('unprepared', Array)
#6 /var/www/ieducar/database/migrations/2020_01_01_150000_create_relatorio_view_historico_9anos_view.php(19): Illuminate\\Support\\Facades\\Facade::__callStatic('unprepared', Array)
#7 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(493): CreateRelatorioViewHistorico9anosView->up()
#8 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(410): Illuminate\\Database\\Migrations\\Migrator->runMethod(Object(App\\Providers\\Postgres\\PostgresConnection), Object(CreateRelatorioViewHistorico9anosView), 'up')
#9 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Concerns/ManagesTransactions.php(30): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}(Object(App\\Providers\\Postgres\\PostgresConnection))
#10 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(418): Illuminate\\Database\\Connection->transaction(Object(Closure))
#11 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->runMigration(Object(CreateRelatorioViewHistorico9anosView), 'up')
#12 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Console/View/Components/Task.php(37): Illuminate\\Database\\Migrations\\Migrator->Illuminate\\Database\\Migrations\\{closure}()
#13 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(756): Illuminate\\Console\\View\\Components\\Task->render('2020_01_01_1500...', Object(Closure))
#14 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(216): Illuminate\\Database\\Migrations\\Migrator->write('Illuminate\\\\Cons...', '2020_01_01_1500...', Object(Closure))
#15 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(181): Illuminate\\Database\\Migrations\\Migrator->runUp('/var/www/ieduca...', 1, false)
#16 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(124): Illuminate\\Database\\Migrations\\Migrator->runPending(Array, Array)
#17 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(90): Illuminate\\Database\\Migrations\\Migrator->run(Array, Array)
#18 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Migrations/Migrator.php(633): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->Illuminate\\Database\\Console\\Migrations\\{closure}()
#19 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Database/Console/Migrations/MigrateCommand.php(83): Illuminate\\Database\\Migrations\\Migrator->usingConnection(NULL, Object(Closure))
#20 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\\Database\\Console\\Migrations\\MigrateCommand->handle()
#21 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/Util.php(41): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#22 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\\Container\\Util::unwrapIfClosure(Object(Closure))
#23 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\\Container\\BoundMethod::callBoundMethod(Object(Illuminate\\Foundation\\Application), Array, Object(Closure))
#24 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Container/Container.php(662): Illuminate\\Container\\BoundMethod::call(Object(Illuminate\\Foundation\\Application),Array, Array, NULL)
#25 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Console/Command.php(211): Illuminate\\Container\\Container->call(Array)
#26 /var/www/ieducar/vendor/symfony/console/Command/Command.php(326): Illuminate\\Console\\Command->execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#27 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Console/Command.php(180): Symfony\\Component\\Console\\Command\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Illuminate\\Console\\OutputStyle))
#28 /var/www/ieducar/vendor/symfony/console/Application.php(1096): Illuminate\\Console\\Command->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#29 /var/www/ieducar/vendor/symfony/console/Application.php(324): Symfony\\Component\\Console\\Application->doRunCommand(Object(Illuminate\\Database\\Console\\Migrations\\MigrateCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#30 /var/www/ieducar/vendor/symfony/console/Application.php(175): Symfony\\Component\\Console\\Application->doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#31 /var/www/ieducar/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(201): Symfony\\Component\\Console\\Application->run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#32 /var/www/ieducar/artisan(35): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#33 {main}
"}

Desde já agradeço qualquer ajuda.