Skip to content

Commit

Permalink
rename users DBscheme
Browse files Browse the repository at this point in the history
change ``user_id` -> ``id``, ``username`` -> ``name``
  • Loading branch information
kenken714 committed Sep 19, 2024
1 parent 59fbebb commit 359097a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions migrations/0_create-table.sql
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
CREATE TABLE IF NOT EXISTS `users` (
`user_id` INT AUTO_INCREMENT PRIMARY KEY,
`username` VARCHAR(255) NOT NULL,
`id` INT AUTO_INCREMENT PRIMARY KEY,
`name` VARCHAR(255) NOT NULL,
`traq_id` VARCHAR(255),
`github_id` VARCHAR(255),
`icon_url` VARCHAR(255),
Expand Down
2 changes: 1 addition & 1 deletion src/repository/users.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub struct User {

impl Repository {
pub async fn get_user_by_id(&self, user_id: i64) -> anyhow::Result<User> {
let user = sqlx::query_as::<_, User>("SELECT * FROM users WHERE user_id = ?")
let user = sqlx::query_as::<_, User>("SELECT * FROM users WHERE id = ?")
.bind(user_id)
.fetch_one(&self.pool)
.await?;
Expand Down

0 comments on commit 359097a

Please sign in to comment.