|
10 | 10 | # |
11 | 11 | # It's strongly recommended that you check this file into your version control system. |
12 | 12 |
|
13 | | -ActiveRecord::Schema[8.1].define(version: 2025_12_01_152312) do |
| 13 | +ActiveRecord::Schema[8.1].define(version: 2025_12_03_141545) do |
14 | 14 | # These are extensions that must be enabled in order to support this database |
15 | 15 | enable_extension "pg_catalog.plpgsql" |
16 | 16 | enable_extension "pg_trgm" |
|
977 | 977 | t.string "snomed_product_code", null: false |
978 | 978 | t.string "snomed_product_term", null: false |
979 | 979 | t.datetime "updated_at", null: false |
| 980 | + t.text "upload_name" |
980 | 981 | t.index ["manufacturer", "brand"], name: "index_vaccines_on_manufacturer_and_brand", unique: true |
981 | 982 | t.index ["nivs_name"], name: "index_vaccines_on_nivs_name", unique: true |
982 | 983 | t.index ["programme_type"], name: "index_vaccines_on_programme_type" |
|
1281 | 1282 | WHERE ((vr.discarded_at IS NULL) AND (vr.outcome = 1) AND ((vr.source IS NULL) OR (vr.source <> 3)))) child_refused ON (((child_refused.patient_id = p.id) AND (child_refused.programme_type = patient_team_prog.s_programme_type) AND (child_refused.academic_year = tl.academic_year)))) |
1282 | 1283 | WHERE ((p.invalidated_at IS NULL) AND (p.restricted_at IS NULL)) |
1283 | 1284 | ) |
1284 | | - SELECT DISTINCT ON (base_data.patient_id, base_data.programme_type, base_data.team_id, base_data.academic_year) base_data.id, |
1285 | | - base_data.patient_id, |
1286 | | - base_data.patient_gender, |
1287 | | - base_data.programme_type, |
1288 | | - base_data.academic_year, |
1289 | | - base_data.team_id, |
1290 | | - base_data.team_name, |
1291 | | - base_data.is_archived, |
1292 | | - base_data.patient_school_local_authority_code, |
1293 | | - base_data.patient_local_authority_code, |
1294 | | - base_data.patient_school_id, |
1295 | | - base_data.patient_school_urn, |
1296 | | - base_data.patient_school_name, |
1297 | | - base_data.session_location_id, |
1298 | | - base_data.patient_year_group, |
1299 | | - base_data.has_any_vaccination, |
1300 | | - base_data.vaccinated_by_sais_current_year, |
1301 | | - base_data.vaccinated_elsewhere_declared_current_year, |
1302 | | - base_data.vaccinated_elsewhere_recorded_current_year, |
1303 | | - base_data.vaccinated_in_previous_years, |
1304 | | - base_data.sais_vaccinations_count, |
1305 | | - base_data.most_recent_vaccination_month, |
1306 | | - base_data.most_recent_vaccination_year, |
1307 | | - base_data.consent_status, |
1308 | | - base_data.consent_vaccine_methods, |
1309 | | - base_data.parent_refused_consent_current_year, |
1310 | | - base_data.child_refused_vaccination_current_year, |
1311 | | - base_data.vaccinated_nasal_current_year, |
1312 | | - base_data.vaccinated_injection_current_year, |
1313 | | - base_data.outside_cohort |
| 1285 | + SELECT DISTINCT ON (patient_id, programme_type, team_id, academic_year) id, |
| 1286 | + patient_id, |
| 1287 | + patient_gender, |
| 1288 | + programme_type, |
| 1289 | + academic_year, |
| 1290 | + team_id, |
| 1291 | + team_name, |
| 1292 | + is_archived, |
| 1293 | + patient_school_local_authority_code, |
| 1294 | + patient_local_authority_code, |
| 1295 | + patient_school_id, |
| 1296 | + patient_school_urn, |
| 1297 | + patient_school_name, |
| 1298 | + session_location_id, |
| 1299 | + patient_year_group, |
| 1300 | + has_any_vaccination, |
| 1301 | + vaccinated_by_sais_current_year, |
| 1302 | + vaccinated_elsewhere_declared_current_year, |
| 1303 | + vaccinated_elsewhere_recorded_current_year, |
| 1304 | + vaccinated_in_previous_years, |
| 1305 | + sais_vaccinations_count, |
| 1306 | + most_recent_vaccination_month, |
| 1307 | + most_recent_vaccination_year, |
| 1308 | + consent_status, |
| 1309 | + consent_vaccine_methods, |
| 1310 | + parent_refused_consent_current_year, |
| 1311 | + child_refused_vaccination_current_year, |
| 1312 | + vaccinated_nasal_current_year, |
| 1313 | + vaccinated_injection_current_year, |
| 1314 | + outside_cohort |
1314 | 1315 | FROM base_data |
1315 | | - ORDER BY base_data.patient_id, base_data.programme_type, base_data.team_id, base_data.academic_year, (base_data.sais_vaccinations_count > 0) DESC, (base_data.outside_cohort = false) DESC, base_data.patient_school_id; |
| 1316 | + ORDER BY patient_id, programme_type, team_id, academic_year, (sais_vaccinations_count > 0) DESC, (outside_cohort = false) DESC, patient_school_id; |
1316 | 1317 | SQL |
1317 | 1318 | add_index "reporting_api_patient_programme_statuses", ["academic_year", "programme_type"], name: "ix_rapi_pps_year_prog_type" |
1318 | 1319 | add_index "reporting_api_patient_programme_statuses", ["id"], name: "ix_rapi_pps_id", unique: true |
|
0 commit comments