insert into oauth_validation ( oauth_validation_public_id , oauth_provider_id , access_token , raw_response , created_at , validated_at ) values ( ?1 , ( select oauth_provider_id from oauth_provider where name = ?2 and flow = ?3 ) , ?4 , ?5 , ?6 , ?7 ) on conflict (oauth_validation_public_id) do update set access_token = excluded.access_token , validated_at = excluded.validated_at , raw_response = excluded.raw_response; -- insert into identity_oauth_validation ( identity_id , oauth_validation_id , revoked_at , deleted_at ) values ( ( select identity_id from identity where identity_public_id = ?1 ) , ( select oauth_validation_id from oauth_validation where oauth_validation_public_id = ?2 ) , ?3 , ?4 ) on conflict (identity_id, oauth_validation_id) do update set revoked_at = excluded.revoked_at , deleted_at = excluded.deleted_at;