Closed LukeBrandon closed 1 year ago
Closes #52
channel
message
ON DELETE CASCADE
~/source/fluke/backend (master*) # curl -X POST -H "Content-Type: application/json" -d '{"name":"Test"}' http://localhost:8000/channels {"id":2,"name":"Test","created_at":"2023-08-14T23:16:47.543928Z"}# ----------------------------------------------------------------------------------------------------------------------------- ~/source/fluke/backend (master*) # curl -X POST -H "Content-Type: application/json" -d '{"message": "test messaage", "user_id": 1}' http://localhost:8000/channels/2/messages {"id":2,"message":"test messaage","created_at":"2023-08-14T23:16:53.345451Z","user_id":1,"channel_id":2}# ----------------------------------------------------------------------------------------------------------------------------- ~/source/fluke/backend (master*) # curl -X DELETE -H "Content-Type: application/json" http://localhost:8000/channels/2 {"error":"Database Error: error returned from database: update or delete on table \"channel\" violates foreign key constraint \"fk_message_channel_id\" on table \"message\""}# ----------------------------------------------------------------------------------------------------------------------------- ~/source/fluke/backend (master*) # sqlx migrate run root@DESKTOP-FD6S1B8 Applied 20230814230137/migrate message cascade delete (3.82432ms) ----------------------------------------------------------------------------------------------------------------------------- ~/source/fluke/backend (master*) # curl -X DELETE -H "Content-Type: application/json" http://localhost:8000/channels/2 {"channel":"Channel deleted"}#
Great work, Luke!
Closes #52
Description of changes
channel
frommessage
toON DELETE CASCADE
Testing strategy