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

fix: create database name #1285

Merged
merged 1 commit into from
Oct 29, 2023
Merged

fix: create database name #1285

merged 1 commit into from
Oct 29, 2023

Conversation

kvii
Copy link
Contributor

@kvii kvii commented Oct 26, 2023


🔍 What type of PR is this?

/kind bug

👀 What this PR does / why we need it:

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

It will failed when you init app with a custom database name which contains '-' (eg: "im-db").

Error 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-db default charset utf8mb4 COLLATE utf8mb4_unicode_ci' at line 1
[0.236ms] [rows:0] CREATE DATABASE IF NOT EXISTS im-db default charset utf8mb4 COLLATE utf8mb4_unicode_ci;

Screenshot:
image

🅰 Which issue(s) this PR fixes:

Fixes #

📝 Special notes for your reviewer:

  • Added a new test.
  • Added a new type option.
  • Note defer sqlDB.Close() has been moved.

🎯 Describe how to verify it

go test -run ^TestMaybeCreateTable$ github.com/openimsdk/open-im-server/v3/pkg/common/db/relation

📑 Additional documentation e.g., RFC, notion, Google docs, usage docs, etc.:

@kvii kvii requested a review from cubxxw as a code owner October 26, 2023 05:38
@pull-request-size pull-request-size bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 26, 2023
@kubbot
Copy link
Member

kubbot commented Oct 26, 2023

CLA Assistant Lite bot 🤖 All Contributors have signed the open-im-server CLA.
The signed information is recorded 🤖here

@kvii kvii temporarily deployed to openim October 26, 2023 05:38 — with GitHub Actions Inactive
@kvii kvii temporarily deployed to openim October 26, 2023 05:38 — with GitHub Actions Inactive
@kvii kvii temporarily deployed to openim October 26, 2023 05:38 — with GitHub Actions Inactive
@kvii kvii temporarily deployed to openim October 26, 2023 05:38 — with GitHub Actions Inactive
@kvii kvii temporarily deployed to openim October 26, 2023 05:38 — with GitHub Actions Inactive
@kvii kvii temporarily deployed to openim October 26, 2023 05:38 — with GitHub Actions Inactive
@sweep-ai
Copy link
Contributor

sweep-ai bot commented Oct 26, 2023

Apply Sweep Rules to your PR?

  • Apply: Leftover TODOs in the code should be handled.
  • Apply: All new business logic should have corresponding unit tests in the tests/ directory.
  • Apply: Any clearly inefficient or repeated code should be optimized or refactored.

@codecov
Copy link

codecov bot commented Oct 26, 2023

Codecov Report

Merging #1285 (ce4f5da) into main (cb03943) will increase coverage by 2.44%.
Report is 1 commits behind head on main.
The diff coverage is 38.00%.

@@           Coverage Diff           @@
##           main   #1285      +/-   ##
=======================================
+ Coverage      0   2.44%   +2.44%     
=======================================
  Files         0      13      +13     
  Lines         0     778     +778     
=======================================
+ Hits          0      19      +19     
- Misses        0     756     +756     
- Partials      0       3       +3     
Files Coverage Δ
pkg/common/db/relation/mysql_init.go 20.87% <38.00%> (ø)

... and 12 files with indirect coverage changes

@kvii
Copy link
Contributor Author

kvii commented Oct 26, 2023

I have read the CLA Document and I hereby sign the CLA

openimbot added a commit to openim-sigs/cla that referenced this pull request Oct 26, 2023
@cubxxw cubxxw enabled auto-merge October 26, 2023 06:11
@cubxxw
Copy link
Contributor

cubxxw commented Oct 26, 2023

Thank you for your contribution to the OpenIM community. This is your first PR and we truly appreciate your help.

@cubxxw cubxxw added this pull request to the merge queue Oct 29, 2023
Merged via the queue into openimsdk:main with commit 7722714 Oct 29, 2023
17 of 18 checks passed
@github-actions github-actions bot added this to the v3.1 milestone Oct 29, 2023
@openimsdk openimsdk locked and limited conversation to collaborators Oct 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants