i've endpoint /user
creates unique uuid user. inserts data(phoneno, gender, age) table(cassandra table) , forwards same data server along user_id created, having mysql db.
now in mysql table follow.
id(varchar) phone no age gender etc.
but i've read using varchar pk bad solution. hence modified table follow:-
id(interger auto increment) user_id (varchar unique) phone no age gender etc.
i have endpoint /recharge
, contains user_id (uuid), recharge_amount, operator, etc.
.
my recharge table follow:-
user_id fk amount operator
now problem arises whenever i'll receive data /recharge
need respective id of user users table reference in recharge table, operation. ie every insert, there read operation.
can reference/use unique key fk in recharge table. if no, can possible solution?
yes, can use unique key foreign key. use column fk in other table has pk or unique key.