Skip to content

Commit 7a8c9dd

Browse files
authored
Revert "Revert "Adds field for discord-id ""
1 parent 11b8181 commit 7a8c9dd

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTER TABLE Member ADD COLUMN discord_id TEXT;

src/db/member.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,5 @@ pub struct Member {
1414
pub sex: String,
1515
pub year: i32,
1616
pub macaddress: String,
17+
pub discord_id: String,
1718
}

src/graphql/mutations.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,15 @@ impl MutationRoot {
2929
sex: String,
3030
year: i32,
3131
macaddress: String,
32+
discord_id: String,
3233

3334
) -> Result<Member, sqlx::Error> {
3435
let pool = ctx.data::<Arc<PgPool>>().expect("Pool not found in context");
3536

3637

3738

3839
let member = sqlx::query_as::<_, Member>(
39-
"INSERT INTO Member (rollno, name, hostel, email, sex, year, macaddress) VALUES ($1, $2, $3, $4, $5, $6, $7) RETURNING *"
40+
"INSERT INTO Member (rollno, name, hostel, email, sex, year, macaddress, discord_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING *"
4041
)
4142
.bind(rollno)
4243
.bind(name)
@@ -45,6 +46,7 @@ impl MutationRoot {
4546
.bind(sex)
4647
.bind(year)
4748
.bind(macaddress)
49+
.bind(discord_id)
4850
.fetch_one(pool.as_ref())
4951
.await?;
5052

0 commit comments

Comments
 (0)