Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all the db tables into the utf8mb4 charset and use it for MySQL connections #1254

Merged
merged 4 commits into from
Mar 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
docker:
- image: cimg/go:1.20.2
- image: circleci/mysql:8.0.28
command: --default-authentication-plugin=mysql_native_password --max-allowed-packet=10485760
command: --default-authentication-plugin=mysql_native_password --max-allowed-packet=10485760 --collation-server=utf8mb4_0900_ai_ci --character-set-server=utf8mb4
environment:
MYSQL_USER: algorea
MYSQL_PASSWORD: dummy_password
Expand Down Expand Up @@ -81,7 +81,7 @@ jobs:
docker:
- image: cimg/go:1.20.2
- image: circleci/mysql:8.0.28
command: --default-authentication-plugin=mysql_native_password --max-allowed-packet=10485760
command: --default-authentication-plugin=mysql_native_password --max-allowed-packet=10485760 --collation-server=utf8mb4_0900_ai_ci --character-set-server=utf8mb4
environment:
MYSQL_USER: algorea
MYSQL_PASSWORD: dummy_password
Expand Down Expand Up @@ -208,8 +208,8 @@ jobs:
dbdoc-gen:
docker:
- image: cimg/go:1.20.2-browsers
- image: circleci/mysql:8.0.20
command: --default-authentication-plugin=mysql_native_password --max-allowed-packet=10485760
- image: circleci/mysql:8.0.28
command: --default-authentication-plugin=mysql_native_password --max-allowed-packet=10485760 --collation-server=utf8mb4_0900_ai_ci --character-set-server=utf8mb4
environment:
MYSQL_USER: algorea
MYSQL_PASSWORD: dummy_password
Expand Down
8 changes: 4 additions & 4 deletions app/api/answers/create_answer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Create a 'saved' answer
When I send a POST request to "/items/50/attempts/1/answers" with the following body:
"""
{
"answer": "print 1",
"answer": "print 1 # 🐱",
"state": "some state"
}
"""
Expand All @@ -46,9 +46,9 @@ Feature: Create a 'saved' answer
}
"""
And the table "answers" should be:
| author_id | attempt_id | participant_id | item_id | type | answer | state | ABS(TIMESTAMPDIFF(SECOND, created_at, NOW())) < 3 |
| 101 | 1 | 101 | 50 | Submission | null | null | 0 |
| 101 | 1 | 101 | 50 | Saved | print 1 | some state | 1 |
| author_id | attempt_id | participant_id | item_id | type | answer | state | ABS(TIMESTAMPDIFF(SECOND, created_at, NOW())) < 3 |
| 101 | 1 | 101 | 50 | Submission | null | null | 0 |
| 101 | 1 | 101 | 50 | Saved | print 1 # 🐱 | some state | 1 |

Scenario: User is able to save an answer as a team
Given I am the user with id "101"
Expand Down
8 changes: 4 additions & 4 deletions app/api/answers/submit.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Feature: Submit a new answer
"""
{
"task_token": "{{userTaskToken}}",
"answer": "print 1"
"answer": "print 1 # 🐱"
}
"""
Then the response code should be 201
Expand All @@ -65,7 +65,7 @@ Feature: Submit a new answer
"randomSeed": "",
"sHintsRequested": "[{\"rotorIndex\":0,\"cellRank\":0}]",
"nbHintsGiven": "12",
"sAnswer": "print 1",
"sAnswer": "print 1 # 🐱",
"idUserAnswer": "5577006791947779410"
}
},
Expand All @@ -78,8 +78,8 @@ Feature: Submit a new answer
user_id=101
"""
And the table "answers" should be:
| author_id | participant_id | attempt_id | item_id | type | answer | ABS(TIMESTAMPDIFF(SECOND, created_at, NOW())) < 3 |
| 101 | 101 | 1 | 50 | Submission | print 1 | 1 |
| author_id | participant_id | attempt_id | item_id | type | answer | ABS(TIMESTAMPDIFF(SECOND, created_at, NOW())) < 3 |
| 101 | 101 | 1 | 50 | Submission | print 1 # 🐱 | 1 |
And the table "results" should be:
| attempt_id | participant_id | item_id | hints_requested | hints_cached | submissions | ABS(TIMESTAMPDIFF(SECOND, latest_activity_at, NOW())) < 3 | ABS(TIMESTAMPDIFF(SECOND, latest_submission_at, NOW())) < 3 |
| 1 | 101 | 10 | null | 0 | 0 | 1 | null |
Expand Down
8 changes: 4 additions & 4 deletions app/api/answers/update_current.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Feature: Update the 'current' answer
When I send a PUT request to "/items/50/attempts/1/answers/current" with the following body:
"""
{
"answer": "print 1",
"answer": "print 1 # 🐱",
"state": "some state"
}
"""
Expand All @@ -46,9 +46,9 @@ Feature: Update the 'current' answer
}
"""
And the table "answers" should be:
| author_id | participant_id | attempt_id | item_id | type | answer | state | ABS(TIMESTAMPDIFF(SECOND, created_at, NOW())) < 3 |
| 101 | 101 | 1 | 50 | Submission | null | null | 0 |
| 101 | 101 | 1 | 50 | Current | print 1 | some state | 1 |
| author_id | participant_id | attempt_id | item_id | type | answer | state | ABS(TIMESTAMPDIFF(SECOND, created_at, NOW())) < 3 |
| 101 | 101 | 1 | 50 | Submission | null | null | 0 |
| 101 | 101 | 1 | 50 | Current | print 1 # 🐱 | some state | 1 |

Scenario: User is able to create the 'current' answer for a team attempt
Given I am the user with id "101"
Expand Down
30 changes: 15 additions & 15 deletions app/api/auth/create_access_token.feature
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ Feature: Create an access token
"""
{
"id":100000001, "login":"mohammed","login_updated_at":"2019-07-16 01:56:25","login_fixed":0,
"login_revalidate_required":0,"login_change_required":0,"language":"en","first_name":"Mohammed",
"last_name":"Amrani","real_name_visible":true,"timezone":"Africa\/Algiers","country_code":"DZ",
"login_revalidate_required":0,"login_change_required":0,"language":"en","first_name":"Mohammed 🐱",
"last_name":"Amrani 🐱","real_name_visible":true,"timezone":"Africa\/Algiers","country_code":"DZ",
"address":null,"city":null,"zipcode":null,"primary_phone":null,"secondary_phone":null,
"role":"student","school_grade":null,"student_id":"123456789","ministry_of_education":null,
"ministry_of_education_fr":false,"birthday":"2000-07-02","presentation":"I'm Mohammed Amrani",
"ministry_of_education_fr":false,"birthday":"2000-07-02","presentation":"I'm Mohammed Amrani 🐱",
"website":"http://mohammed.freepages.com","ip":"127.0.0.1","picture":"http:\/\/127.0.0.1:8000\/images\/user.png",
"gender":"m","graduation_year":2020,"graduation_grade_expire_at":"2020-07-01 00:00:00",
"graduation_grade":0,"created_at":"2019-07-16 01:56:25","last_login":"2019-07-22 14:47:18",
Expand All @@ -59,10 +59,10 @@ Feature: Create an access token
"data": {"category": "", "round": null},
"manager": false,
"badge_info": {
"name": "Example #1",
"name": "Example #1 🐱",
"group_path": [
{"url": "https:\/\/badges.example.com\/", "name": "Example badges", "manager": true},
{"url": "https:\/\/badges.example.com\/parents", "name": "Example badges with multiple parents", "manager": false}
{"url": "https:\/\/badges.example.com\/", "name": "Example badges 🐱", "manager": true},
{"url": "https:\/\/badges.example.com\/parents", "name": "Example badges with multiple parents 🐱", "manager": false}
]
},
"last_update": "2022-07-18T16:07:12+0000"
Expand All @@ -85,16 +85,16 @@ Feature: Create an access token
"""
And the response header "Set-Cookie" should be "<expected_cookie>"
And the table "users" should be:
| group_id | latest_login_at | latest_activity_at | temp_user | registered_at | latest_profile_sync_at | login_id | login | email | first_name | last_name | student_id | country_code | birth_date | graduation_year | grade | address | zipcode | city | land_line_number | cell_phone_number | default_language | free_text | web_site | sex | email_verified | last_ip | time_zone | notify_news | photo_autoload | public_first_name | public_last_name |
| 5577006791947779410 | 2019-07-16 22:02:28 | 2019-07-16 22:02:28 | 0 | 2019-07-16 22:02:28 | 2019-07-16 22:02:28 | 100000001 | mohammed | [email protected] | Mohammed | Amrani | 123456789 | dz | 2000-07-02 | 2020 | 0 | null | null | null | null | null | en | I'm Mohammed Amrani | http://mohammed.freepages.com | Male | 0 | 127.0.0.1 | Africa/Algiers | true | true | true | true |
| group_id | latest_login_at | latest_activity_at | temp_user | registered_at | latest_profile_sync_at | login_id | login | email | first_name | last_name | student_id | country_code | birth_date | graduation_year | grade | address | zipcode | city | land_line_number | cell_phone_number | default_language | free_text | web_site | sex | email_verified | last_ip | time_zone | notify_news | photo_autoload | public_first_name | public_last_name |
| 5577006791947779410 | 2019-07-16 22:02:28 | 2019-07-16 22:02:28 | 0 | 2019-07-16 22:02:28 | 2019-07-16 22:02:28 | 100000001 | mohammed | [email protected] | Mohammed 🐱 | Amrani 🐱 | 123456789 | dz | 2000-07-02 | 2020 | 0 | null | null | null | null | null | en | I'm Mohammed Amrani 🐱 | http://mohammed.freepages.com | Male | 0 | 127.0.0.1 | Africa/Algiers | true | true | true | true |
And the table "groups" should be:
| id | name | type | description | ABS(TIMESTAMPDIFF(SECOND, NOW(), created_at)) < 3 | is_open | send_emails | text_id |
| 2 | AllUsers | Base | null | false | false | false | null |
| 4 | TempUsers | Base | null | false | false | false | null |
| 4037200794235010051 | Example badges | Other | null | true | false | false | https://badges.example.com/ |
| 5577006791947779410 | mohammed | User | mohammed | true | false | false | null |
| 6129484611666145821 | Example badges with multiple parents | Other | null | true | false | false | https://badges.example.com/parents |
| 8674665223082153551 | Example #1 | Other | null | true | false | false | https://badges.example.com/examples/one |
| id | name | type | description | ABS(TIMESTAMPDIFF(SECOND, NOW(), created_at)) < 3 | is_open | send_emails | text_id |
| 2 | AllUsers | Base | null | false | false | false | null |
| 4 | TempUsers | Base | null | false | false | false | null |
| 4037200794235010051 | Example badges 🐱 | Other | null | true | false | false | https://badges.example.com/ |
| 5577006791947779410 | mohammed | User | mohammed | true | false | false | null |
| 6129484611666145821 | Example badges with multiple parents 🐱 | Other | null | true | false | false | https://badges.example.com/parents |
| 8674665223082153551 | Example #1 🐱 | Other | null | true | false | false | https://badges.example.com/examples/one |
And the table "groups_groups" should be:
| parent_group_id | child_group_id |
| 2 | 4 |
Expand Down
Loading