diff --git a/src/libs/routes/enrollment.js b/src/libs/routes/enrollment.js
index 74ba538adc9d010a2c3ed8f748a9f8cf90996030..d08025c9d0b3c387ccd628a9c4bb53cdee02775f 100644
--- a/src/libs/routes/enrollment.js
+++ b/src/libs/routes/enrollment.js
@@ -19,16 +19,15 @@ let rqf = new ReqQueryFields();
 // Complete range of the enrollments dataset.
 // Returns a tuple of start and ending years of the complete enrollments dataset.
 enrollmentApp.get('/year_range', (req, res, next) => {
-    req.sql.from('turma')
-    .field('MIN(turma.ano_censo)', 'start_year')
-    .field('MAX(turma.ano_censo)', 'end_year');
-
+    req.sql.from('matricula')
+    .field('MIN(matricula.ano_censo)', 'start_year')
+    .field('MAX(matricula.ano_censo)', 'end_year');
     next();
 }, query, response('range'));
 
 enrollmentApp.get('/location', (req, res, next) => {
     req.sql = squel.select()
-        .field('pk_localizacao_id', 'id')
+        .field('id')
         .field('descricao', 'name')
         .from('localizacao');
     next();
@@ -37,18 +36,16 @@ enrollmentApp.get('/location', (req, res, next) => {
 // Returns all educational levels avaible
 enrollmentApp.get('/education_level', (req, res, next) => {
     req.sql.from('etapa_ensino')
-    .field('pk_etapa_ensino_id', 'id')
+    .field('id', 'id')
     .field('desc_etapa', 'name');
-
     next();
 }, query, response('education_level'));
 
 // Returns all adm dependencies
 enrollmentApp.get('/adm_dependency', (req, res, next) => {
     req.sql.from('dependencia_adm')
-    .field('pk_dependencia_adm_id', 'id')
+    .field('id', 'id')
     .field('nome', 'name');
-
     next();
 }, query, response('adm_dependency'));
 
@@ -68,12 +65,12 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'pk_dependencia_adm_id'
+        field: 'id'
     },
     join: {
-        primary: 'pk_dependencia_adm_id',
-        foreign: 'fk_dependencia_adm_id',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'dependencia_adm_id',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'education_level',
@@ -83,12 +80,12 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'pk_etapa_ensino_id'
+        field: 'id'
     },
     join: {
-        primary: 'pk_etapa_ensino_id',
-        foreign: 'fk_etapa_ensino_id',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'etapa_ensino_id',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'region',
@@ -98,12 +95,12 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'pk_regiao_id'
+        field: 'id'
     },
     join: {
-        primary: 'pk_regiao_id',
-        foreign: 'fk_regiao_id',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'cod_regiao',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'state',
@@ -113,12 +110,12 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'pk_estado_id'
+        field: 'id'
     },
     join: {
-        primary: 'pk_estado_id',
-        foreign: 'fk_estado_id',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'escola_estado_id',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'city',
@@ -128,12 +125,12 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'pk_cod_ibge'
+        field: 'id'
     },
     join: {
-        primary: 'pk_cod_ibge',
-        foreign: 'fk_municipio_id',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'escola_municipio_id',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'school',
@@ -143,12 +140,12 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'cod_entidade'
+        field: 'id'
     },
     join: {
-        primary: 'cod_entidade',
-        foreign: 'cod_entidade',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'escola_id',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'location',
@@ -158,31 +155,16 @@ rqf.addField({
     where: {
         relation: '=',
         type: 'integer',
-        field: 'pk_localizacao_id'
-    },
-    join: {
-        primary: 'pk_localizacao_id',
-        foreign: 'fk_localizacao_id',
-        foreignTable: 'turma'
-    }
-}).addValue({
-    name: 'city',
-    table: 'municipio',
-    tableField: 'nome',
-    resultField: 'city_name',
-    where: {
-        relation: '=',
-        type: 'integer',
-        field: 'pk_cod_ibge'
+        field: 'id'
     },
     join: {
-        primary: 'pk_cod_ibge',
-        foreign: 'fk_municipio_id',
-        foreignTable: 'turma'
+        primary: 'id',
+        foreign: 'localizacao_id',
+        foreignTable: 'matricula'
     }
 }).addValue({
     name: 'min_year',
-    table: 'turma',
+    table: 'matricula',
     tableField: 'ano_censo',
     resultField: 'year',
     where: {
@@ -192,7 +174,7 @@ rqf.addField({
     }
 }).addValue({
     name: 'max_year',
-    table: 'turma',
+    table: 'matricula',
     tableField: 'ano_censo',
     resultField: 'year',
     where: {
@@ -204,12 +186,13 @@ rqf.addField({
 
 enrollmentApp.get('/', rqf.parse(), rqf.build(), (req, res, next) => {
     log.debug(req.sql.toParam());
-    req.sql.field('COALESCE(SUM(num_matriculas), 0)', 'total')
+    req.sql.field('COALESCE(COUNT(matricula.id), 0)', 'total')
     .field("'Brasil'", 'name')
-    .field('turma.ano_censo', 'year')
-    .from('turma')
-    .group('turma.ano_censo')
-    .order('turma.ano_censo');
+    .field('matricula.ano_censo', 'year')
+    .from('matricula')
+    .group('matricula.ano_censo')
+    .order('matricula.ano_censo')
+    .where('matricula.tipo=0 OR matricula.tipo=1 OR matricula.tipo=2 OR matricula.tipo=3');
     next();
 }, query, response('enrollment'));