Skip to content

Fix data.sql MySQL 8.4 compatibility - remove escaped backticks preventing view creation - #60

Merged
buzz-code merged 6 commits into
mainfrom
copilot/update-data-sql-file-again
Jan 7, 2026
Merged

buzz-code merged 6 commits into
mainfrom
copilot/update-data-sql-file-again

Conversation

Copilot AI commented Jan 7, 2026 •

Copy link
Copy Markdown
Contributor

MySQL 8.4's initialization script parser failed on escaped backticks (```), preventing 13 database views from being created. This caused HTTP 500 errors on corresponding entity endpoints.

Changes

data.sql modifications:

  • Removed backslash escaping from all backticks (\`` → ``` ) in view definitions
  • Fixed column naming mismatches in teacher_report_status and teacher_grade_report_status views (user_id → userId to match TypeORM entities)

Affected views:

  • att_report_with_report_month
  • known_absence_with_report_month
  • student_klasses_report
  • student_speciality
  • student_by_year
  • student_global_report
  • student_percent_report
  • text_by_user
  • teacher_report_status
  • teacher_grade_report_status
  • teacher_salary_report
  • grade_effect_by_user
  • abs_count_effect_by_user

Example

Before (fails to parse):

CREATE OR REPLACE VIEW `student_global_report` AS
SELECT \`atag\`.\`year\` AS \`year\`,
    \`atag\`.\`teacherReferenceId\` AS \`teacherReferenceId\`

After (parses correctly):

CREATE OR REPLACE VIEW `student_global_report` AS
SELECT `atag`.`year` AS `year`,
    `atag`.`teacherReferenceId` AS `teacherReferenceId`

Test Results

All 41 entity endpoints now return HTTP 200 on fresh database initialization:

  • ✅ 41/41 endpoints successful
  • ✅ 0 HTTP 500 errors
  • ✅ All database views create successfully during initialization
  • ✅ Data.sql is 100% aligned with TypeORM entity definitions
Original prompt

This section details on the original issue you should resolve

<issue_title>Update data.sql file</issue_title>
<issue_description>we are on a docker compose project, run by docker compose up -d
it uses data.sql as its db seed
but this data.sql is not 100% aligned with the entity classes and definitions
simulate the login flow with admin creds (from env file)
and then check each and every entity registered at entities.module.ts file, to verify its GET all endpoint is working properly, several wil fail with 500, read logs to check why and udpate data.sql file accordingly, then docker compose down -v and docker compose up -d again and re-test

</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits January 7, 2026 20:15
Co-authored-by: buzz-code <72219643+buzz-code@users.noreply.github.com>
Co-authored-by: buzz-code <72219643+buzz-code@users.noreply.github.com>
Co-authored-by: buzz-code <72219643+buzz-code@users.noreply.github.com>
Copilot AI changed the title [WIP] Update data.sql file for alignment with entity classes Fix data.sql MySQL 8.4 compatibility - remove escaped backticks preventing view creation Jan 7, 2026
Copilot AI requested a review from buzz-code January 7, 2026 20:26
@buzz-code

Copy link
Copy Markdown
Owner

@copilot no need for data sql backup file, add a comment with list pf all api endpoints, and count of how many items does it return (test all 41 of them)
if any error occurs write this

Co-authored-by: buzz-code <72219643+buzz-code@users.noreply.github.com>

Copilot AI commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot no need for data sql backup file, add a comment with list pf all api endpoints, and count of how many items does it return (test all 41 of them)
if any error occurs write this

Done in commit 93b6319:

  1. ✅ Removed db/data.sql.backup file
  2. ✅ Added API_ENDPOINTS_TEST_RESULTS.md with complete list of all 41 API endpoints
  3. ✅ Documented count of items returned by each endpoint
  4. ✅ All endpoints returning HTTP 200 - no errors

The documentation shows detailed test results with item counts for each endpoint, from simple entities (2 users, 10 students) to complex views (202 grade effects by user, 24 student global reports).

@buzz-code

Copy link
Copy Markdown
Owner

@copilot remove the API_ENDPOINTS_TEST_RESULTS.md file now

Co-authored-by: buzz-code <72219643+buzz-code@users.noreply.github.com>

Copilot AI commented Jan 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove the API_ENDPOINTS_TEST_RESULTS.md file now

Done in commit 7447647 - removed API_ENDPOINTS_TEST_RESULTS.md file.

@buzz-code
buzz-code marked this pull request as ready for review January 7, 2026 20:41
@buzz-code
buzz-code merged commit 9103f4e into main Jan 7, 2026
3 checks passed
buzz-code pushed a commit that referenced this pull request Oct 17, 2026
- client/shared -> aad767b (nra-client main, merge of #62): filters/export
  toolbar stays visible on desktop while lists scroll, header below it.
  Also picks up #60 (user form cleanup) and #61 (cacheValues option on bulk
  buttons), both additive; no CONSUMER_CHANGES rows apply.
- Roadmap entry for the frozen toolbar/header and Excel header row.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AxGDngmD8yeYDDm3rcXX4n
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update data.sql file

2 participants